This documentation is for WSO2 Enterprise Integrator version 6.1.1 . View documentation for the latest release in the 6.x.x family and the latest release in the 7.x.x family.

All docs This doc

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

BPMN REST tasks allow you to invoke REST endpoints within your BPMN processes. This can be achieved by adding a REST Task and handling the REST invocation part in a process implementation. EI-Business Process has provided this functionality out of the box to avoid the hassle of doing implementations by process developers.

Table of Contents
maxLevel4
minLevel3

Adding a REST task to a process

...

Code Block
languagexml
<serviceTask id="servicetask2" name="Rest task2" activiti:class="org.wso2.carbon.bpmn.extensions.rest.RESTTask">
    <extensionElements>
        <activiti:field name="serviceRef">
            <activiti:expression>conf:/test1/service2</activiti:expression>
        </activiti:field>
        <activiti:field name="method">
            <activiti:string>
                <![CDATA[POST]]>
            </activiti:string>
        </activiti:field>
        <activiti:field name="input">
            <activiti:expression>{ "companyName":"ibm", "industry":"${industry}", "address":{ "country":"USA", "state":"${state}"} }
            </activiti:expression>
        </activiti:field>
        <activiti:field name="outputMappings">
            <activiti:string>
                <![CDATA[var2:customer.name,var3:item.price]]>
            </activiti:string>
        </activiti:field>
    </extensionElements>
</serviceTask>

Configuring the HTTP client

The above REST task is bundled with an HTTP client by default. You can edit its configurations in the <EI_HOME>/wso2/business-process/conf/activiti.xml file as shown in the example below.

Code Block
<bean id="restClientConfiguration">
        <property name="maxTotalConnections" value="200"/>
        <property name="maxConnectionsPerRoute" value="200"/>
        <property name="connectionTimeout" value="12000"/>
        <property name="socketTimeout" value="12000"/>
</bean>