Process variable output to calling REST client

726 views
Skip to first unread message

mp4...@att.com

unread,
Feb 10, 2016, 9:31:09 AM2/10/16
to camunda BPM users
I need to output values at the end of a process so that the REST client can see them. I know that if you call certain methods, you get JSON back. I know how to "print" to server console.

What I can't figure out is, how to send back "data" to the REST client that started the process? I've looked at output parameters, which my process has, but when the process is started and completes, the client doesn't "see" anything other than something like the following:

{

"id": "testWorkflow:4:72ef13ac-baea-aBcD-b8d7-43k1fb437723",
"key": "testWorkflow",
"category": "http://activiti.org/bpmn",
"description": "This is a test workflow",
"name": "Test Workflow",
"version": 4,
"resource": "bpmn/testWorkflow.bpmn",
"deploymentId": "72ef13ac-baea-aBcD-b8d7-43k1fb437723",
"diagram": "bpmn/testWorkflow.png",
"suspended": false

}

Within the process, I get responses from services that are stored in variables like soapResponse. I want to send the value of soapResponse back to the REST client.

How do I do this?

Thanks.

mp4...@att.com

unread,
Feb 10, 2016, 9:40:08 AM2/10/16
to camunda BPM users, mp4...@att.com
Here's an example of the BPMN source code within the service task that should "emit" the variable value:

<camunda:inputOutput>
<camunda:outputParameter name="soapResponse">${wsResponse} </camunda:inputOutput>

I thought it would help for you to know what I was doing now so that you could correct my ignorance.

Ingo Richtsmeier

unread,
Feb 10, 2016, 9:50:25 AM2/10/16
to camunda BPM users, mp4...@att.com
Hi,

you have to query the history service (can be done by rest, too, see https://docs.camunda.org/manual/7.4/reference/rest/history/variable-instance/get-variable-instance-query/ for instance) to get data from the finished process. You can access process variables and a lot of other data.

Hope this helps,

Ingo

mp4...@att.com

unread,
Feb 10, 2016, 10:21:17 AM2/10/16
to camunda BPM users, mp4...@att.com
So how does Camunda output the JSON it sends to the REST client when you, for instance, request a process count?

I'd rather avoid the overhead of getting the process ID, querying history, etc.

Can't the process or one of its Java delegate classes simply emit what I want sent back to the REST client?

I'm ignorant about a lot the technology behind Camunda, so don't hesitate to "dumb it down".

Thanks.

Philipp Ossler

unread,
Feb 15, 2016, 2:53:51 AM2/15/16
to camunda BPM users, mp4...@att.com
Hi,

I see two ways the client can get the required data which is stored as process variable. First, the client requests the data via rest call [1]. To do so, it needs the id of the process instance that can be query [2], if needed. 

Second, the process actively sends the data to the client. So the process must know the client and how to send the data. For example, the client starts the process instance and sets the address (e.g. a rest end point) for the call back as process variable. See the example [3] how to send data via REST using a service task.

Greetings,
Philipp

Reply all
Reply to author
Forward
0 new messages