Hi ,Can you guide me as how to start a process instance using activiti.I have referred user guide http://activiti.org/userguide/index.html#N12345In that you have metioned to use #
Request: POST /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
}But how can i use this in my application. Where to write Request: POST /process-instance?Is it possible to start a process instance using javaScript?I tried 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);
}
}
xhr.send("processDefinitionKey=bookorder"); //working[/color] // REST CALL
}
catch(ex)
{
alert("Exception"+ex.message);
}
}I am getting error as ExceptionAccess to restricted URI denied
How to start the process using javascript? Where am i going wrong?Thanks,kavi