06-17-2011 02:50 PM
Get Process Definition
Returns details about a deployed process definition.
Request: [b]GET[/b] /process-definition/{processDefinitionId}
API: ProcessEngines.getProcessEngine(configuredProcessEngineName).getProcessService().createProcessDefinitionQuery().processDefinitionId(processDefinitionId)
Response:
{
"id": "financialReport:1",
"key": "financialReport",
"version": 1,
"name": "Monthly financial report",
"resourceName": "org/activiti/examples/bpmn/usertask/FinancialReportProcess.bpmn20.xml",
"deploymentId": "10",
"startFormResourceKey": null
}
Request: [b]POST[/b] /process-instance
{
"processDefinitionId":"financialReport:1:1700",
"businessKey":"order-4711"
}
API: ProcessEngines.getProcessEngine(configuredProcessEngineName).getRuntimeService().startProcessInstanceById(processDefinitionId[, businessKey][, variables])
Response:
{
"id": "217",
"processDefinitionId": "financialReport:1:1700",
"activityNames": ["writeReportTask"],
"ended": true
}
06-20-2011 08:35 AM
06-20-2011 10:05 AM
06-20-2011 11:26 AM
function sendPost()
{
var data = [{"processDefinitionId":"restprocessid:1:1425"}];
var xhr = new XMLHttpRequest();
var url = "http://localhost:8080/activiti-rest/service/process-instance";
xhr.open("POST", url, true);
//The following line tells the REST service to use the DELETE method instead of the POST method. This is
//an architectural implementation due to the limits of clients supporting GET and POST methods, but
//not necessarily PUT and DELETE methods.
xhr.setRequestHeader("X-Method-Override","DELETE");
xhr.onreadystatechange = function() {
if (xhr.readyState==4 && xhr.status==200) {
//check for an error message contained in the REST response.
//If xhr.responseText is blank, update was successful.
alert("SUCCESS");
}
else
{
alert("ERROR in RESPONSE: "+xhr.status+" , "+xhr.responseText);
}
}
try {
xhr.send (JSON.stringify(data));
}
catch(ex)
{
alert("Exception"+ex.message);
}
}
11:17:07,304 ERROR [extensions.webscripts.AbstractRuntime] Exception from executeScript - redirecting to status template error: 05200003 Script url /process-instance does not support the method OPTIONS
org.springframework.extensions.webscripts.WebScriptException: 05200003 Script url /process-instance does not support the method OPTIONS
at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:159)
at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:636)
06-20-2011 03:21 PM
print $myVar
function sendPost()
{
try {
var xhr = new XMLHttpRequest();
var url = "http://localhost:8080/activiti-rest/service/process-instance";
xhr.open("POST", url, true,"kermit","kermit");
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState==4 && xhr.status==200) {
//check for an error message contained in the REST response.
//If xhr.responseText is blank, update was successful.
alert("SUCCESS");
}
else
{
alert("ERROR in RESPONSE: "+xhr.status+" , "+xhr.responseText);
}
}
[color=#FF0000] xhr.send("processDefinitionKey=restprocessid&myVar=man"); //working[/color] // REST CALL
}
catch(ex)
{
alert("Exception"+ex.message);
}
}
ERROR in RESPONSE: 500 , {
"status" :
{
"code" : 500,
"name" : "Internal Error",
"description" : "An error inside the HTTP server which prevented it from fulfilling the request."
},
"message" : "05200032 Wrapped Exception (with status template): problem evaluating script: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: myVar for class: Script12",
"exception" : "org.springframework.extensions.webscripts.WebScriptException - 05200032 Wrapped Exception (with status template): problem evaluating script: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: myVar for class: Script12",
"callstack" :
[
"" ,"[color=#FF0000]groovy.lang.MissingPropertyException: No such property: myVar for class: Script12"[/color]
,"org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:49)"
,"org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49)"
,"org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:239)"
,"Script12.run(Script12.groovy:1)"
,"org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:315)"
,"org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:111)"
,"javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233)"
,"org.activiti.engine.impl.scripting.ScriptingEngines.evaluate(ScriptingEngines.java:70)"
,"org.activiti.engine.impl.bpmn.behavior.ScriptTaskActivityBehavior.execute(ScriptTaskActivityBehavior.java:43)"
,"org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:40)"
,"org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:76)"
,"org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:481)"
,"org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerStart.eventNotificationsCompleted(AtomicOperatio
nTransitionNotifyListenerStart.java:48)"
,"org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:52)"
06-21-2011 02:09 AM
06-21-2011 10:23 AM
"status" :
{
"code" : 500,
"name" : "Internal Error",
"description" : "An error inside the HTTP server which prevented it from fulfilling the request."
},
"message" : "05210009 Wrapped Exception (with status template): problem evaluating script: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: myVar for class: Script9",
"exception" : "org.springframework.extensions.webscripts.WebScriptException - 05210009 Wrapped Exception (with status template): problem evaluating script: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: myVar for class: Script9",
public static void main(String[] args) {
// TODO Auto-generated method stub
Client client = Client.create();
client.addFilter(new HTTPBasicAuthFilter("kermit", "kermit"));
WebResource webResource = client.resource("http://localhost:8080/activiti-rest/service/process-instance");
MultivaluedMap formData = new MultivaluedMapImpl();
formData.add("processDefinitionKey", "restprocessid");
formData.add("myVar_type", "Integer");
formData.add("myVar", "2");
ClientResponse response = webResource.type("application/x-www-form-urlencoded").post(ClientResponse.class, formData);
System.out.println(response.toString());
}
06-22-2011 01:34 AM
processDefinitionKey=myprocess&myVar=prasad&myVar_type=string
06-22-2011 10:33 AM
processDefinitionKey=restprocessid&input=prasad&input_type=string
{
"status" :
{
"code" : 500,
"name" : "Internal Error",
"description" : "An error inside the HTTP server which prevented it from fulfilling the request."
},
"message" : "05220009 Wrapped Exception (with status template): problem evaluating script: javax.script.ScriptException: [color=#FF0000]groovy.lang.MissingPropertyException: No such property: input for class: Script10", [/color]
"exception" : "org.springframework.extensions.webscripts.WebScriptException - 05220009 Wrapped Exception (with status template): problem evaluating script: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: input for class: Script10",
"callstack" :
[
"" ,"groovy.lang.MissingPropertyException: No such property: input for class: Script10"
,"org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:49)"
,"org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49)"
,"org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:239)"
,"Script10.run(Script10.groovy:1)"
:
:
06-22-2011 11:31 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.