Webmethods BPM: Using Correlation Tutorial- Part 2

We discussed in the last tutorial how we can design a business process waiting for external response or event using the correlation, and we mentioned that there are three ways to implement correlation using web methods BPM 1)Field, 2)correlation service, and 3) manual. We covered implementing the correlation by Field in our last tutorial. Today we are going to cover the service correlation.

It is strongly recommended to read the first part of the tutorial before reading this one.

Here is the link for part 1:

https://webmethodsexpert.com/2014/09/21/webmethods-bpm-using-correlation-tutorial-part-1/

 

Note: This tutorial is valid for web methods versions 8, and 9.

We will use the same example of part 1:

Description of the process:

We will assume that we are designing a process to perform credit check for a bank before accepting a loan request. We will send the request to the credit office and our process will be waiting for the asynchronous response from the credit office. After receiving the response we will notify the customer by email.

Here is the subscription document we will use to start the model:

Field name Description
LoanRequest The subscription document name (publishable document)
LoanRequest/requestNumber The unique id of the customer request
LoanRequest/socialInsuranceNumber the social insurance number of the customer (unique government number for each person)
LoanRequest/lastName the last name of the customer
LoanRequest/firstName the first name of the customer
LoanRequest/dateOfBirth the date of birth of the customer
LoanRequest/postalCode the postal code of the customer
LoanRequest/telephoneNumber the phone number of the customer
LoanRequest/email the email of the customer, which will be used to inform the customer of the result of the request.

 

Here is the process model we designed:

bp main

 

To configure the business process model to use the correlation, please follow the following steps:

1. Choose the subscription document which will start the model, by clicking on the receive step (NewLoanRequest in our example), go the properties tab –> Implementation, and choose the receive Document (in our example ‘LoanRequest’).

subscription step document

 

 

2. For the receive step move from the implementation to Correlation tab, then choose ‘service’ and choose the name of the service which will generate the correlation id. In our example the service name is ‘CreateLoadCorrelationId’.

This service is responsible only for constructing the correlationId.

Our correlationId will be the ‘loan request number’ followed by the ‘social insurance number’. So assuming that the loan request number is ‘9999’ and the social insurance number is ‘123123123’, then the correlation id will be ‘9999123123123’.

The input parameters of the service which will generate the correlation is the ‘loanRequest’ document, and the output of the correlation service must be ‘processCorrelationID’

 

createCorrId_constructID

 

 

we assume that we expose a web service to receive the response and then we will publish the document ‘CreditCheckResult’ to continue the processing of the model.

 

3. Assign a flow service to the step SendCreditCheck which will call the credit office web service to send the request, and we will receive the response asynchronously.

4. Configure the joint of the step ‘CheckResponse’ as ‘And’, to make sure that the model will be stored in the database without using any Integration server resources in a waiting state till receiving the response of the intermediate receive step ‘ReceiveCreditOfficeResponse’.

5. Define your response document ‘CreditCheckResult’ as follows:

Name Description
CreditCheckResult The publishable response document
CreditCheckResult/requestNumber Is a unique id for the customer request
CreditCheckResult/socialInsuranceNumber the social insurance number of the client.
CreditCheckResult/creditScore the credit score of the customer.
CreditCheckResult/isBlackListed flag is indicate if the customer is blacklisted or not.
CreditCheckResult/rating Customer rating (high profile, low profile, … etc)

 

6. Configure the intermediate receive step ‘ReceiveCreditOfficeResponse’ from the properties tab –> implementation –> Receive document.

7. Move form implementation to correlation tab, choose radio button‘service’, and choose the correlation service (in our example: getResponseCorrelationId)

getResponseCorrelationId

8. The input parameter of our correlation service is ‘creditCheckResult’, and of course the output must be ‘processCorrelationID’.

    9. Assign a flow service to the step ‘NotifyCustomer’, which will send an email to the customer with the request result.

 

Now your model is ready for the deployment and testing.

So finally we use the service correlation if the correlation value is complex and is not present in the subscription or intermediate receive step, and you will have to construct it based on some calculation or by checking it in another system.

We hope that you enjoyed the tutorial, and looking forwards reading your comments, and questions.

 

Follow us:

on twitter: @WM_Expert

LinkedIn group: webmethodsExpert.com

(C) 2014 Hossam Elsharkawy. All rights reserved.