This article shows how to convert BPEL process from an asynchronous to a synchronous and synchronous to asynchronous in 11g. Whether a process is asynchronous or synchronous by just some small settings in composite.xml, componentType, .bpel and wsdl files is very easy to convert from one to another. To get the Asynchronous have to add additional code base to synchronous process and to get the Synchronous have to delete the required code base to synchronous process. Bothe are in vies versa.
When creating BPEL processes, by default we have to modify below four files:
1. composite.xml
2. .bpel
3. .wsdl
4. .componentType
Composite.xml:
Have to the delete the red marked code base in the service tag in Asynchronous composite.xml file achieve the Synchronous.
Have to add the red marked code base in the service tag in Synchronous composite.xml file to achieve the Asynchronous.
Async composit.xml
<service name="syncbpelprocess_client_ep" ui:wsdlLocation="SyncBPELProcess.wsdl">
<interface.wsdl interface="http://xmlns.oracle.com/training/Helloworld/SyncBPELProcess#wsdl.interface(SyncBPELProcess)"
callbackInterface="http://xmlns.oracle.com/training/Helloworld/SyncBPELProcess#wsdl.interface(SyncBPELProcessCallback)" />
<binding.ws port="http://xmlns.oracle.com/training/Helloworld/SyncBPELProcess#wsdl.endpoint(syncbpelprocess_client_ep/SyncBPELProcess_pt)"/>
<callback>
<binding.ws port="http://xmlns.oracle.com/training/Helloworld/SyncBPELProcess#wsdl.endpoint(syncbpelprocess_client_ep/SyncBPELProcessCallback_pt)"/>
</callback>
</service>
replace oneWayDeliveryPolicy with transaction and async.persist with required in the below property.
<property name="bpel.config.oneWayDeliveryPolicy" type="xs:string"
many="false">async.persist</property>
After remove the asynchronous related code base form the composite.xml file the modified file will be like below (Sync composite.xml)
Sync composite.xml
<service name="syncbpelprocess_client_ep" ui:wsdlLocation="SyncBPELProcess.wsdl">
<interface.wsdl interface="http://xmlns.oracle.com/training/Helloworld/SyncBPELProcess#wsdl.interface(SyncBPELProcess)"/>
<binding.ws port="http://xmlns.oracle.com/training/Helloworld/SyncBPELProcess#wsdl.endpoint(syncbpelprocess_client_ep/SyncBPELProcess_pt)"/>
</service>
<property name="bpel.config.transaction" type="xs:string"
many="false">required</property>
.wsdl file:
Add the ProcessResponseMessage tag in Process port Type and delete the process call back port type. The deleted code base would be the blow red mark and added tag is in the bold.
Delete the ProcessResponseMessage tag in Process port Type and add the process call back port type. The added code base would be the blow red mark and the code base in the bold should be removed.
<wsdl:portType name="BPELProcess1">
<wsdl:operation name="process">
<wsdl:input message="client:BPELProcess1RequestMessage" />
<wsdl:output message="client:BPELProcess1ResponseMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:portType name="SyncBPELProcessCallback">
<wsdl:operation name="processResponse">
<wsdl:input message=" client:BPELProcess1ResponseMessage "/>
</wsdl:operation>
</wsdl:portType>
Delete the below red marked requester role to achieve Synchronous from an Asynchronous.
Add the below red marked requester role to achieve Asynchronous from Synchronous.
<plnk:partnerLinkType name="SyncBPELProcess">
<plnk:role name="SyncBPELProcessProvider">
<plnk:portType name="client:SyncBPELProcess"/>
</plnk:role>
<plnk:role name="SyncBPELProcessRequester">
<plnk:portType name="client:SyncBPELProcessCallback"/>
</plnk:role>
</plnk:partnerLinkType>
.bpel file: Have to delete partner role at partner link in the .bpel file to achieveSynchronous.
<partnerLinks>
<partnerLink name="syncbpelprocess_client" partnerLinkType="client:SyncBPELProcess" myRole="SyncBPELProcessProvider" partnerRole="SyncBPELProcessRequester"/>
After delete the partner role partner link will be like below
<partnerLink name="syncbpelprocess_client" partnerLinkType="client:SyncBPELProcess" myRole="SyncBPELProcessProvider"/>
</partnerLinks>
In the sequence replace invoke with reply, callbackClient with replyOutput, SyncBPELProcessCallback with SyncBPELProcessa, processResponse with process and replace the inputVariable with variable.
<sequence name="main">
<invoke name="callbackClient" partnerLink="syncbpelprocess_client" portType="client:SyncBPELProcessCallback" operation="processResponse" inputVariable="outputVariable"/>
<reply name="replyOutput" partnerLink="syncbpelprocess_client" portType="client:SyncBPELProcess" operation="process" variable="outputVariable"/>
</sequence>
. componentType
Have to the delete the red marked code base in the service tag in “.componentType” file to get Synchronous.
Have to the add the red marked code base in the service tag in “.componentType” file to get Asynchronous.
<service name="syncbpelprocess_client_ep" ui:wsdlLocation="SyncBPELProcess.wsdl">
<interface.wsdl interface="http://xmlns.oracle.com/training/Helloworld/SyncBPELProcess#wsdl.interface(SyncBPELProcess)"
callbackInterface="http://xmlns.oracle.com/training/Helloworld/SyncBPELProcess#wsdl.interface(SyncBPELProcessCallback)" />
</service>
After delete it will become a synchronous “.componentType” file.
<service name="syncbpelprocess_client_ep" ui:wsdlLocation="SyncBPELProcess.wsdl">
<interface.wsdl interface="http://xmlns.oracle.com/training/Helloworld/SyncBPELProcess#wsdl.interface(SyncBPELProcess)"/>
</service>
After that open the BPEL window and refresh the client partner link and then compiled the process
After that open the BPEL window and refresh the client partner link and then compiled the process