Monday, 20 November 2017

Converting Synchronous bpel process to asynchronous

Hi,

This is aslo little tricky, where we cannot just delete reply activity from .bpel to make it asynchronous process.

To make the developed synchronous bpel process to asynchronous we need to make changes in .bpel and .wsdl files generated.

Steps: {Marked in RED are the changes to be carried out.}

1. In .bpel File:

    a) In Partner link tag we need to add partner role

<partnerLink name="multiplicationprocess_client" partnerLinkType="client:MultiplicationProcess" myRole="MultiplicationProcessProvider" partnerRole="MultiplicationProcessRequestor"/>

    b) In Recieve tag change operation from Process to Initiate

<receive name="receiveInput" partnerLink="multiplicationprocess_client" portType="client:MultiplicationProcess" operation="Initiate" variable="inputVariable" createInstance="yes"/>

    c) In Reply activity
we have: <reply name="replyOutput" partnerLink="multiplicationprocess_client" portType="client:MultiplicationProcess" operation="process" variable="outputVariable"/>

Do the following Changes:

<Invokename="callbackClient" partnerLink="multiplicationprocess_client" portType="client:MultiplicationProcessCallback" operation="onResult" variable="outputVariable"/>

2. In .wsdl file

    a) Port type
For synchronous we have  Port type defined as below:
<wsdl:portType name="MultiplicationProcess">
<wsdl:operation name="process">
<wsdl:input  message="client:MultiplicationProcessRequestMessage" />
<wsdl:output message="client:MultiplicationProcessResponseMessage"/>
</wsdl:operation>
</wsdl:portType>

Copy paste it twice and do the required changes, and we can comment or delete the sync port typ tag defined above.

<wsdl:portType name="MultiplicationProcess">
<wsdl:operation name="Initiate">
<wsdl:input  message="client:MultiplicationProcessRequestMessage" />
<!--<wsdl:output message="client:MultiplicationProcessResponseMessage"/>-->
</wsdl:operation>

</wsdl:portType>
        <wsdl:portType name="MultiplicationProcessCallback">
<wsdl:operation name="onResult">
<wsdl:input  message="client:MultiplicationProcessRequestMessage" />
<!--<wsdl:output message="client:MultiplicationProcessResponseMessage"/>-->
</wsdl:operation>
(Delete or comment wsdl:output message)

    b) In PartnerLink
For sync we have:
<plnk:partnerLinkType name="MultiplicationProcess">
<plnk:role name="MultiplicationProcessProvider">
<plnk:portType name="client:MultiplicationProcess"/>
</plnk:role>
</plnk:partnerLinkType>

For async we need to add one more role and port type within partnerlink definition:
<plnk:partnerLinkType name="MultiplicationProcess">
<plnk:role name="MultiplicationProcessProvider">
<plnk:portType name="client:MultiplicationProcess"/>
</plnk:role>
                <plnk:role name="MultiplicationProcessRequestor">
<plnk:portType name="client:MultiplicationProcessCallback"/>
</plnk:role>
</plnk:partnerLinkType>

Thats it! now synchronous becomes Asynchronous process.

Let's explore SOA


No comments:

Post a Comment