Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
...
When invoking a service asynchronously, we need to define two roles (myRole
and 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 aportType
, which defines the partnerRole
and another portType
which definesmyRole
.
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.
1. Log in into BPS server management console and select "Processes -> Add" under the "Main" menu.
2. Upload the <EI_HOME>/
samples/business-process/bpel/
LoanProcess.zip
. (Samples are located at our sample repository). directory.
3. In the "Deployed Processes" window, click the "Process ID" to access its "Process Information" window.
...
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,
Code Block | ||
---|---|---|
| ||
<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> |
...