I am actually looking for a quickfix … sorry abt that .
can some one share a sample example for orchestrating restful webservices using camunda.
I am trying to do something like
- fire a login service 2) get the auth-token from the login service and use it to call a search user service. 3) use the authtoken to call the logout service.
If anyone has a sample project on github . please share the link.
I started with the rest service example available and tweaked it to invoke my own rest service:
<?xml version="1.0" encoding="UTF-8"?><bpmn2:definitions xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xmlns:bpmn2=“http://www.omg.org/spec/BPMN/20100524/MODEL” xmlns:bpmndi=“http://www.omg.org/spec/BPMN/20100524/DI” xmlns:camunda=“http://camunda.org/schema/1.0/bpmn” xmlns:dc=“http://www.omg.org/spec/DD/20100524/DC” xmlns:di=“http://www.omg.org/spec/DD/20100524/DI” xsi:schemaLocation=“http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd” id="_B0ppIPFYEeOlke_H2tkzCA" exporter=“camunda modeler” exporterVersion=“2.6.0” targetNamespace=“http://camunda.org/examples”>
<bpmn2:process id=“loginSearchLogout” name=“login and search” isExecutable=“true”>
<bpmn2:startEvent id=“StartEvent_1” name=“start with date”>
bpmn2:outgoingSequenceFlow_1</bpmn2:outgoing>
</bpmn2:startEvent>
<bpmn2:serviceTask id=“ServiceTask_1” name=“fire login service”>
bpmn2:extensionElements
<camunda:connector>
<camunda:connectorId>http-connector</camunda:connectorId>
<camunda:inputOutput>
<camunda:inputParameter name="url">
http://localhost:7001/middleware/bda/BancsService
</camunda:inputParameter>
<camunda:inputParameter name="method">
POST
</camunda:inputParameter>
<camunda:inputParameter name="headers">
<camunda:map>
<camunda:entry key="Accept">
application/json
</camunda:entry>
x-tcs-servicename:login
<camunda:entry key="x-tcs-backofficeid">
Bancs
</camunda:entry>
<camunda:entry key="x-tcs-language">
1
</camunda:entry>
<camunda:entry key="x-tcs-deviceid">
gfy45768686trydry
</camunda:entry>
<camunda:entry key="x-tcs-servicename">
login
</camunda:entry>
</camunda:map>
</camunda:inputParameter>
<camunda:inputParameter name="payload">
{"data":{"type":"com.tcs.bfsarch.security.callback.LoginDetails","id":"loginDetails","attributes":{"loginId":"SYSADMIN1","password":"abcd1234","ouid":"G"}}}
</camunda:inputParameter>
</camunda:inputOutput>
</camunda:connector>
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
</bpmn2:serviceTask>
</bpmn2:process>
</bpmn2:definitions>
The output of this service http://localhost:7001/middleware/bda/BancsService should be a json like below , however this webservice call does not happen or i am unable to get the result json
{
“data”: [
{
“type”: “com.middleware.common.UserToken”,
“attributes”: {
“status”: “SUCCESS”,
“authToken”: “1795013009”,
“description”: “Login Successful.”,
“txn_DTL”: null,
“auditTableName”: null
}
}
]
}
- I get the below error with the below code:
RuntimeService runtimeService = processEngineRule.getRuntimeService();
TaskService taskService = processEngineRule.getTaskService();
runtimeService.startProcessInstanceByKey("loginSearchLogout", variables);
Task task = taskService.createTaskQuery().singleResult();
INFO: ENGINE-00001 Process Engine default created.
Dec 27, 2016 3:36:09 PM org.camunda.commons.logging.BaseLogger logError
SEVERE: ENGINE-16004 Exception while closing command context: execution 4 doesn’t exist: execution is null
org.camunda.bpm.engine.exception.NullValueException: execution 4 doesn’t exist: execution is null
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.Delegat
- what code will give the output json mentioned above to me as a string from which i can take out the authtoken and call another service?