This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Invoking a SOAP Endpoint from a BPMN Workflow

BPMN SOAP tasks allow you to invoke SOAP endpoints within your BPMN processes. This can be achieved by adding a SOAP Task and handling the SOAP 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.

Adding a SOAP task to a process

  1. Create a BPMN process and a BPMN diagram. For instructions, see Creating a BPMN Process.
  2. Drag and drop a SOAP Task from the tools palette in the place where you need to invoke the endpoint. 
    Drag and drop a SOAP task
  3. Go to the Properties panel of the SOAP Task and select the Main config tab. 
  4. Enter values for the following fields appropriately, as shown in the example below.

    Field NameString ValueRequired/Optional
    Service URL URL of the target endpointRequired
    Input PayloadRequest payloadOptional
    SOAP HeadersSOAP header block, which is attached to the SOAP header when creating the SOAP requestOptional
    SOAP versionSoap version to be used when creating the SOAP request (i.e., SOAP11 or SOAP12)Required
    HTTP ConnectionControl options for the current connection. ('keep-alive' is the the default value.)Optional
    HTTP Transfer EncodingThe form of encoding, which is used to safely transfer the entity to the userOptional
    Output Variable nameName of the variable to save the responseRequired
    Transport headers

    Header values in the format

    "headerName0":"headerValue0","headerName1":"header Value2"
    Optional

    SOAP task properties

The following configuration provides an example definition to use as the SOAP task.

<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">
	<process id="myProcess" name="My process" isExecutable="true">
		<serviceTask id="servicetask1" name="SOAP Task" activiti:class="org.wso2.carbon.bpmn.extensions.soap.SOAPTask" activiti:extensionId="org.wso2.developerstudio.bpmn.extensions.soapTask.SOAPTask">
			<extensionElements>
				<activiti:field name="serviceURL">
					<activiti:expression>http://10.0.3.1:9773/soapSample1_1.0.0/services/soap_sample1/${method}</activiti:expression>
				</activiti:field>
				<activiti:field name="payload">
					<activiti:string>&lt;m:getFullQuote
						xmlns:m="http://services.samples/xsd"&gt;
                                &lt;m:request&gt;
                                &lt;m:symbol&gt;IBM&lt;/m:symbol&gt;
                                &lt;/m:request&gt;
                                &lt;/m:getFullQuote&gt;
					</activiti:string>
				</activiti:field>
				<activiti:field name="headers">
					<activiti:string>&lt;headers:ServerHeader
						xmlns:headers="http://www.roguewave.com/examples/webservice/headers"
         env:mustUnderstand="0"&gt;MyValue: From the server&lt;/headers:ServerHeader&gt;
					</activiti:string>
				</activiti:field>
				<activiti:field name="soapVersion">
					<activiti:string>soap11</activiti:string>
				</activiti:field>
				<activiti:field name="httpConnection">
					<activiti:string>keep-alive</activiti:string>
				</activiti:field>
				<activiti:field name="outputVariable">
					<activiti:string>output</activiti:string>
				</activiti:field>
				<activiti:field name="soapAction">
					<activiti:string>urn:sayHello</activiti:string>
				</activiti:field>
				<activiti:field name="transportHeaders">
					<activiti:string>&lt;p1:Code
						xmlns:p1="http://www.XYZ.com/XSD"&gt;XYZ&lt;/p1:Code&gt;
					</activiti:string>
				</activiti:field>
			</extensionElements>
		</serviceTask>
	</process>
	<bpmndi:BPMNDiagram id="BPMNDiagram_myProcess">
		<bpmndi:BPMNPlane bpmnElement="myProcess" id="BPMNPlane_myProcess">
			<bpmndi:BPMNShape bpmnElement="servicetask1" id="BPMNShape_servicetask1">
				<omgdc:Bounds height="55.0" width="105.0" x="340.0" y="60.0"></omgdc:Bounds>
			</bpmndi:BPMNShape>
		</bpmndi:BPMNPlane>
	</bpmndi:BPMNDiagram>
</definitions>