title: Error Invoke a BPMN REST Endpoint from the wso2 business process server
body: <p>I want to send a message to the proxy service of ESB from BPMN REST of business process server but when i invoke a process, an exception is thrown.</p>
  
  <pre><code>TID: [-1234] [] [2017-08-30 18:22:15,504] ERROR {org.wso2.carbon.bpmn.extensions.rest.RESTTask} -  Failed to execute POST http://localhost:8280/services/bpmnProxy within task servicetask1:REST Task in process instance 7501 {org.wso2.carbon.bpmn.extensions.rest.RESTTask}
  com.fasterxml.jackson.core.JsonParseException: Unexpected character ('C' (code 67)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
   at [Source: java.io.StringReader@5dbc3edb; line: 1, column: 2]
      at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1369)
      at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:532)
      at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:453)
      at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._handleUnexpectedValue(ReaderBasedJsonParser.java:1386)
      at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:669)
      at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:2926)
      at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:2873)
      at com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:1750)
      at org.wso2.carbon.bpmn.core.types.datatypes.json.JSONUtils.parse(JSONUtils.java:42)
      at org.wso2.carbon.bpmn.extensions.rest.RESTTask.execute(RESTTask.java:210)
      at org.activiti.engine.impl.delegate.JavaDelegateInvocation.invoke(JavaDelegateInvocation.java:34)
  
  
  TID: [-1234] [] [2017-08-30 18:22:15,525] ERROR {org.wso2.carbon.bpmn.rest.common.provider.ExceptionMapper.BPMNExceptionHandler} -  Activiti Exception Occured  {org.wso2.carbon.bpmn.rest.common.provider.ExceptionMapper.BPMNExceptionHandler}
  org.activiti.engine.delegate.BpmnError: No catching boundary event found for error with errorCode 'REST_CLIENT_INVOKE_ERROR', neither in same process nor in parent process (errorCode='REST_CLIENT_INVOKE_ERROR') (errorCode='REST_CLIENT_INVOKE_ERROR')
      at org.activiti.engine.impl.bpmn.helper.ErrorPropagation.propagateError(ErrorPropagation.java:82)
      at org.activiti.engine.impl.bpmn.helper.ErrorPropagation.propagateError(ErrorPropagation.java:60)
      at org.activiti.engine.impl.bpmn.helper.ClassDelegate.execute(ClassDelegate.java:160)
      at org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:60)
      at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97)
      at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:644)
      at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:637)
      at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerStart.eventNotificationsCompleted(AtomicOperationTransitionNotifyListenerStart.java:52)
      at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:56)
      at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:97)
  </code></pre>
  
  <p>What i do wrong?</p>
  
  <p>The call scheme:
  Client->proxy service of esb->Business process->Invoke Rest API->Proxy service of esb</p>
  
  <p>1.Proxy service of esb->business process:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;proxy xmlns="http://ws.apache.org/ns/synapse" name="processProxy" startOnLoad="true" statistics="disable" trace="disable" transports="http,https"&gt;
     &lt;target&gt;
        &lt;inSequence&gt;
           &lt;payloadFactory media-type="json"&gt;
              &lt;format&gt;
              {
                "processDefinitionKey":"myProcess",
                "tenantId": "-1234",
                "variables": [
                  {
                    "name":"Name",
                    "value":"$1"
                  }]
              }
              &lt;/format&gt;
              &lt;args&gt;
                 &lt;arg evaluator="xml" expression="//req/name/text()"/&gt;
              &lt;/args&gt;
           &lt;/payloadFactory&gt;
           &lt;header expression="fn:concat('Basic ', base64Encode('admin:admin'))" name="Authorization" scope="transport"/&gt;
           &lt;header name="Content-Type" scope="transport" value="application/json"/&gt;
           &lt;header name="Accept" scope="transport" value="application/json"/&gt;
           &lt;log level="full"/&gt;
           &lt;send&gt;
              &lt;endpoint&gt;
                 &lt;http method="POST"
                       uri-template="https://localhost:9445/bpmn/runtime/process-instances"/&gt;
              &lt;/endpoint&gt;
           &lt;/send&gt;
        &lt;/inSequence&gt;
        &lt;outSequence&gt;
           &lt;log level="full"/&gt;
        &lt;/outSequence&gt;
        &lt;faultSequence/&gt;
     &lt;/target&gt;
     &lt;description/&gt;
  &lt;/proxy&gt;
  </code></pre>
  
  <p>2.Business process->invoke Rest API:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test"&gt;
    &lt;process id="myProcess" name="My process" isExecutable="true"&gt;
      &lt;startEvent id="startevent1" name="Start"&gt;
        &lt;extensionElements&gt;
          &lt;activiti:formProperty id="vName" name="vName" type="string" variable="vName" required="true"&gt;&lt;/activiti:formProperty&gt;
        &lt;/extensionElements&gt;
      &lt;/startEvent&gt;
      &lt;serviceTask id="servicetask1" name="REST Task" activiti:class="org.wso2.carbon.bpmn.extensions.rest.RESTTask" activiti:extensionId="org.wso2.developerstudio.bpmn.extensions.restTask.RESTTask"&gt;
        &lt;extensionElements&gt;
          &lt;activiti:field name="serviceURL"&gt;
            &lt;activiti:string&gt;http://localhost:8280/services/bpmnProxy&lt;/activiti:string&gt;
          &lt;/activiti:field&gt;
          &lt;activiti:field name="method"&gt;
            &lt;activiti:string&gt;POST&lt;/activiti:string&gt;
          &lt;/activiti:field&gt;
          &lt;activiti:field name="input"&gt;
            &lt;activiti:expression&gt;{
   "Name":"${vName}"
  }&lt;/activiti:expression&gt;
          &lt;/activiti:field&gt;
          &lt;activiti:field name="headers"&gt;
            &lt;activiti:string&gt;Content-Type:application/json&lt;/activiti:string&gt;
          &lt;/activiti:field&gt;
        &lt;/extensionElements&gt;
      &lt;/serviceTask&gt;
      &lt;endEvent id="endevent1" name="End"&gt;&lt;/endEvent&gt;
      &lt;sequenceFlow id="flow1" sourceRef="startevent1" targetRef="servicetask1"&gt;&lt;/sequenceFlow&gt;
      &lt;sequenceFlow id="flow2" sourceRef="servicetask1" targetRef="endevent1"&gt;&lt;/sequenceFlow&gt;
    &lt;/process&gt;
  &lt;/definitions&gt;
  </code></pre>
  
  <p>3.Invoke Rest API->proxy service of esb</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;proxy xmlns="http://ws.apache.org/ns/synapse" name="bpmnProxy" startOnLoad="true" statistics="disable" trace="disable" transports="http,https"&gt;
     &lt;target&gt;
        &lt;inSequence&gt;
           &lt;property expression="json-eval($.Name)" name="vName" scope="default" type="STRING"/&gt;
           &lt;payloadFactory media-type="xml"&gt;
              &lt;format&gt;
                 &lt;req&gt;
                    &lt;name&gt;$1&lt;/name&gt;
                 &lt;/req&gt;
              &lt;/format&gt;
              &lt;args&gt;
                 &lt;arg evaluator="xml" expression="get-property('vName')"/&gt;
              &lt;/args&gt;
           &lt;/payloadFactory&gt;
           &lt;property name="HTTP_METHOD" scope="axis2" type="STRING" value="POST"/&gt;
           &lt;property name="DISABLE_CHUNKING" scope="axis2" type="STRING" value="true"/&gt;
           &lt;send&gt;
              &lt;endpoint&gt;
                 &lt;address uri="http://192.168.18.1:8740"/&gt;
              &lt;/endpoint&gt;
           &lt;/send&gt;
        &lt;/inSequence&gt;
        &lt;outSequence&gt;
           &lt;payloadFactory media-type="json"&gt;
              &lt;format&gt;
          {
            "result":"success"
          } 
              &lt;/format&gt;
              &lt;args/&gt;
           &lt;/payloadFactory&gt;
           &lt;property name="messageType" scope="axis2" type="STRING" value="application/json"/&gt;
           &lt;send/&gt;
        &lt;/outSequence&gt;
        &lt;faultSequence/&gt;
     &lt;/target&gt;
     &lt;description/&gt;
  &lt;/proxy&gt;
  </code></pre>