rest-http-connector not passing parameters from bpmn schema

1,775 views
Skip to first unread message

Anton Evangelatov

unread,
Sep 18, 2014, 9:02:27 AM9/18/14
to camunda-...@googlegroups.com
Hello,

If I define a Java delegate class that is using the RestHttpConnector, a POST request is made correctly, and I receive the payload on the remote API.

RestHttpConnector connector = new RestHttpConnector();
RestHttpRequest request = connector.createRequest();
request.requestUrl("http://192.168.19.30:3000/workflow_tasks/deny_membership");
request.header("Accept", "application/json");
request.requestPayload("process_instance_id=" + execution.getProcessInstanceId());
request.post();

However if I try to define a rest-http-service as described in https://github.com/camunda/camunda-bpm-examples/blob/master/servicetask/rest-service/src/main/resources/invokeRestService.bpmn , and add requestPayload parameter to the schema , the POST request is made, but the payload is lost. No exceptions are thrown.

<camunda:inputParameter name="requestPayload">process_instance_id=smth</camunda:inputParameter>

I tried to debug this for a few hours, but was unable to determine why the payload is lost, although it works fine when called from Java delegate class.

Any idea how to define JSON payload inside the BPMN schema?

Thank you.

Best regards,

Anton

Sebastian Menski

unread,
Sep 23, 2014, 4:17:42 AM9/23/14
to camunda-...@googlegroups.com
Hi Anton,

could you please provide your whole ServiceTask XML?

This would be an example where the json body is saved in a process variable:

<serviceTask id="save-customer-ratings" name="Save Customer Ratings (REST)">
  <extensionElements>
   
<camunda:connector>
     
<camunda:connectorId>rest-http-connector</camunda:connectorId>
     
<camunda:inputOutput>
       
<camunda:inputParameter name="requestUrl">
          http://localhost:8080/rating-service-1.0.0-SNAPSHOT/rest/customer-ratings/create
       
</camunda:inputParameter>
       
<camunda:inputParameter name="requestType">POST</camunda:inputParameter>
       
<camunda:inputParameter name="requestHeaders">
         
<camunda:map>
           
<entry key="Content-Type">application/json</entry>
         
</camunda:map>
       
</camunda:inputParameter>
       
<camunda:inputParameter name="requestPayload">
          ${customerRatings}
       
</camunda:inputParameter>
       
<camunda:outputParameter name="statusCode">
          ${statusCode}
       
</camunda:outputParameter>
     
</camunda:inputOutput>
   
</camunda:connector>
  </extensionElements>
</serviceTask>

Cheers,
Sebastian

Reply all
Reply to author
Forward
0 new messages