When invoking a service asynchronously, we need to define two roles (
partnerRole) for the partner link. In a synchronous interaction only
partnerRole is need to be defined. These roles are defined in partner link type and they map to particular port types. A partner link type binds two port types; port type process offers(
myRole) to a partner and port type partner offers(
partnerRole) to a process. In the above example
DILoanService is invoked asynchronously and
DILoanService has to provide a
portType, which defines the
partnerRole and another
portType which defines
Deploying the Sample
WSO2 BPS provides a sample, which can be deployed and executed to understand the constructs. Follow the instructions below to deploy and trigger the process.
How asynchronous interaction works
In LoanServiceLoanProcess.bpel, the following snippet is given.
5. partnerLink="DILoanServicePL" - An essential attribute in a <receive /> element. This determines the WSDL's portType to be chosen based on the partnerLinkType attribute and the myRole attributes defined in the particular <partnerLink /> element. For example, in LoanServiceLoanProcess.bpel,
<partnerLinks><partnerLinkname="DILoanServicePL" partnerLinkType="ns2:LoanServicePT" partnerRole="LoanServiceRole" myRole="LoanServiceClientRole"/></partnerLinks> ......... <receivename="ReceiveDILoanService" createInstance="no" partnerLink="DILoanServicePL" operation="onLoanOffer" portType="ns2:LoanServiceCallbackPortType" variable="diLoanServiceResponse"><correlations><correlationset="correlator" initiate="no"></correlation></correlations></receive>