This documentation is work in progress and will be released with the next WSO2 EI version.
Step 3 - Creating the Correlation Set - WSO2 Enterprise Integrator 6.x.x - WSO2 Documentation

All docs This doc
||
Skip to end of metadata
Go to start of metadata

With the loan approval process, in a practical scenario, there could be an issue with mapping the request/response. In a real-world scenario, there will be multiple clients sending their loan request to the BPEL process simultaneously. The same customer can send multiple loan requests as well. In a situation like this, how will the BPEL process map the different loan requests with their matching loan responses?

Consider the following questions:

  1. How to map response1 to client A’s request1 instead of request2?

  2. How to map response1 to client A’s request1 instead of client B’s request1?

The solution to this is to add a Correlation Set. Once you add a correlation to the BPEL process, it will map the different request-response pairs accordingly.

Considering the BPEL process created above, this issue occurs when the Asynchronous Process comes into place. At the receiveLoanOffer step, it needs to match the relevant loan response to the initial loan request. Therefore, follow the instructions in the below sections to create a Correlation Set for the Asynchronous Process of the scenario.

Let's get started!  Follow the instructions in the below sections to add the  Correlation Set to the below BPEL Workflow you created in Step2.

If you did not follow Step 2 - Creating the Asynchronous Process yet, you can import the pre-packaged project of it and continue by following the steps in this Tutorial. Follow the steps below to import it to WSO2 Integration Studio.

  1. Open the WSO2 Integration Studio, click File, and click Import
  2. Expand the WSO2 category and select Existing WSO2 Projects into workspace, click Next and upload the pre-packaged project

Also, if you are facing any problems with this Tutorial, you can import the pre-packaged project of this Tutorial to WSO2 Integration Studio, and compare your configurations with the ones in it.

Creating the Correlation Set

Follow the instructions below to add a correlation to this process.

  1. Click on the receiveInput element.
  2. In WSO2 Integration Studio under the BankLoanProcess menu, click the + sign on the Correlation Sets panel, to add a new correlation.
  3. Select the Correlation Set you created, and click Add in the Details section of its Properties tab.
  4. Click New in the Select a Property window.
  5. Enter id as the Name and click Browse.
  6. Select From Imports under Show XSD Types, select Simple Types and Complex Types under Filter, select the string XML Schema under the Matches and click OK.
  7. Click OK in the message, which pops up the set the prefix of the namespace.

Creating the first Alias of the Correlation Set

  1. Click the New located next to the Aliases label in the Create Message Property window.

    This maps the Correlation property you created to the matching property of the receiveInput request. This is to act as the alias for correlation.

  2. Select Message Type and click Browse.
  3. Select From Project under Show XSD Types, select Messages under Filter.

  4. Select  BankLoanProcessRequestMessage under Matches, select CustomerID : CustomerIDType  under Type Structure and click OK.


  5. Click OK in the Create Property Alias window.

Creating the second Alias of the Correlation Set

  1. Click the New located next to the Aliases label in the Create Message Property window.

    This maps the Correlation property you created to the matching property of the receiveInput request. This is to act as the alias for correlation.

  2. Select  Message Type and click  Browse.
  3. Select From Project under Show XSD Types, select Messages under Filter.

  4. Select  getLoanOfferResponse under Matches, select CustomerID : CustomerIDType under Type Structure and click OK.


  5. Click OK in all the subsequent windows.

Mapping the Correlation to the request

  1. Click on the receiveInput element and click Add in the Correlation section of its Properties tab.
  2. Select Yes under the Initiation column for the correlation you added.
  3. Click on the ReceiveLoanOffer element and click Add in the Correlation section of its Properties tab.
  4. Select No under the Initiation column for the correlation you added.

Setting the ports of the Partner Links for deployment

  1. Double click on the  deploy.xml  file in the  Package Explorer
     
  2. In the deploy.xml file, under Inbound Interfaces (Services), select the following values for each of the Partner Links, from the drop-down list of the Associated Port column.

    Partner LinkAssociated Port
    clientBankLoanProcessPort
    LoanPLLoanServiceCallbackPort

  3. In the deploy.xml file, under Out bound Interfaces (Invokes), select the following values for each of the Partner Links,  from the drop-down list of the  Associated Port column. 

    Partner LinkAssociated Port
    CustomerPLCustomerInfoPort
    CreditPLCreditRatingPort
    LoanPLLoanServicePort

     

Deploying the artifacts

  1. For instructions on creating the deployable artifacts, see Creating the deployable archive.
  2. For instructions on deploying them, see Deploying the BPEL Workflow.
  3. Upload the following files by browsing them from the <EI_HOME>/samples/business-process/bpel directory,  to deploy the three back-end services (i.e.,   CustomerInfoServiceCreditRatingServiceLoanService  ), which are invoked from the BankLoanProcess.

    • CustomerInfo.zip

    • CreditRating.zip

    • LoanService.zip

    For instructions, see Deploying the BPEL Workflow.

Testing the output

  1. In the Management Console of the Business Process profile, click Main  →  Manage  →  Processes  →  List  →  BPEL, and click on the Process ID of the Bank Loan BPEL process you uploaded.
  2. In the WSDL details section, select client as the Partner Link and click Try It

    You can now invoke it with input values. 

  3. In the Request section of the Try It tool, replace the question marks with appropriate values for the Name, Email, Customer IDCredit Rating, Amount and Number of Years.
  4. Click Send. You view the response in the Response section.
  • No labels