0% found this document useful (0 votes)
4 views

EI620_BusinesProcessProfile_Labkit

The document provides a comprehensive guide for creating and deploying BPMN processes using WSO2 Enterprise Integrator 6.2.0, focusing on a leave application process. It includes prerequisites, detailed instructions for setting up the project, and step-by-step guidance for modeling the process, including user tasks, decision gateways, and email notifications. Additionally, it covers enhancements like boundary events and signal events for process escalation and external task management.

Uploaded by

ferryliang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

EI620_BusinesProcessProfile_Labkit

The document provides a comprehensive guide for creating and deploying BPMN processes using WSO2 Enterprise Integrator 6.2.0, focusing on a leave application process. It includes prerequisites, detailed instructions for setting up the project, and step-by-step guidance for modeling the process, including user tasks, decision gateways, and email notifications. Additionally, it covers enhancements like boundary events and signal events for process escalation and external task management.

Uploaded by

ferryliang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 62

WSO2 Enterprise Integrator 6.2.

0
Labkit
Developer Fundamentals - Business Process Profile

[email protected]
Table of Contents

Prerequisites

Lab: BPMN Process Creation

Lab: BPEL Process Creation

Lab: Human Task


Prerequisites

Install the Business Process Profile of WSO2 Enterprise Integrator (EI)


https://docs.wso2.com/display/EI620/Installation+Guide

Install Eclipse IDE and the WSO2 EI Tooling Plugin


https://docs.wso2.com/display/EI620/Installing+Enterprise+Integrator+Tooling
Lab: BPMN Process Creation
BPMN supports development of complex business processes, which include invocations to
many external services and user tasks. Unlike BPEL, BPMN is not coupled to WSDL and SOAP.
Hence, we can easily develop BPMN processes to interact with systems that do not support
SOAP. BPMN 2.0 is supported in WSO2 EI from version 6.0.0 onwards. Following is a simple
business scenario depicted via a BPMN process.

Training Objective
Learn how to create BPMN processes.

Business Scenario
The leave application process is a process that involves different levels of human interaction
throughout. It would start with an employee requesting for leave with a leave form submission,
which will be checked by the relevant manager who can either approve or reject it. Finally, the
employee will be notified of leave approval or rejection. Follow the steps below to model this
process as a BPMN process.

High Level Steps


● Creating an Activiti Project
● Creating the BPMN Process
● Deploying the BPMN Process

Detailed Instructions

Setting Up the Project


1. Start Eclipse and navigate to​ File > New > Other​. From the window that appears select
Activiti > Activiti Project​ and click N
​ ext​.
2. Provide a suitable Project Name and click ​Finish​. (For this tutorial, name the project as
“Activiti Project”)
3. Right-click on your project and navigate to​ New > Other​. From the window that
appears, select ​Activiti > Activiti Diagram​.
4. Select the project in the viewer, enter a filename and click F
​ inish​. (For this tutorial, name
the diagram as “LeaveApprovalProcess.bpmn”)

5. The palette found on the right side of the BPMN process lists down all the necessary
BPMN notations. Every BPMN process should start with a ‘start event’ and end with an
‘end event’. Drag a ​StartEvent​ node to the design space as seen below. You can also
update the properties ​Name​ field accordingly.
6. The first step of the BPMN process is where a user submits a leave application form.
Add the application form to the start event. To do this, click on the StartEvent node and
go to the F​ orm​ tab of the ​Properties​ panel.

7. Click ​New​ and add a new field for each of the following fields.
Number of days

Id numberOfDays

Name Number of days

Type long

Readable true

Writeable true

Required true

Start Date

Id startDate

Name First day of holiday (dd-MM-yyyy)

Type string

Date Pattern dd-MM-yyyy hh:mm


Readable true

Writeable true

Required true

Vacation Reason

Id vacationReason

Name Reason

Type string

Readable true

Writeable true

Required true

Employee Name

Id employeeName

Name Name of employee

Type string

Readable true

Writeable true

Required true

8. Now you need to add an initiator to the start event. Go to the M


​ ain config ​tab of the
Properties​ panel and add the initiator field.
9. The next step of the process is where the respective manager checks the leave
application form and approves/rejects it. For this part of the process, add a ​UserTask as
it will be a task performed by a user. To add a user task, hover over the ​StartEvent on
the design canvas, click on ​new element ​and select ​Create user task​. Name it “Review
leave request”.

10. Click on the user task and go to the ​Form​ tab of the ​Properties​ panel. Click on ​New​ and
add the following field:
○ For fields of type “enum” you can add form values that act as different options.
You can provide two options “Approve” and “Reject” for this field.

Vacation Approval

Id vacationApproved

Name Do you approve this vacation request?

Type enum

Readable true
Writeable true

Required true

Form Values

Id true

Name Approve

Id false

Name Reject

11. Now you need to add an assignee to the user task. Assuming that a single person (e.g.,
HR manager) is responsible for approving or rejecting leave, you can go to the M
​ ain
Config​ tab and enter the relevant user in the ​Assignee​ field.
○ If you want to allow a group of people (e.g, anyone in the HR department) to
approve/reject leave, you can enter the group role name (“hrDepartment”) in the
Candidate group​ field.
12. The next part of the process depends on two possible outputs; approval of the request
and rejection of the request. If the request was approved, you can send an email to the
employee. If it was rejected, you can let the employee decide whether to re-submit a
leave request or end the process.

To indicate these two actions, add a decision making notation. Hover over the UserTask
and click ​new exclusive gateway​.

13. Click on the gateway and go to the G


​ eneral​ tab of the ​Properties​ panel. Fill in the
following fields:
○ Id: requestApprovedDecision
○ Name: Request approved?

14. Add two tasks for the two actions by dragging and dropping them from the P ​ alette​, as
you did when adding the user task above; a mail task to send a confirmation email if the
request is approved and a user task to adjust the vacation request if it is rejected.

15. Click on the mail task and go to the G


​ eneral​ tab of the ​Properties​ panel. Enter S
​ end
confirmation e-mail ​as the value for the N
​ ame​ field. Similarly, name the user task
Adjust vacation request​.

16. Next, you need to add the decision logic that specifies that the process should proceed
to the mail task if approved and to the user task if rejected. 00.
Click on the arrow leading to the mail task and enter the following condition in the ​Main
config​ tab of the P
​ roperties​ panel.
○ ${vacationApproved == 'true'}
○ “vacationApproved” is the id of the enum field we added to the R ​ eview leave
request​ user task.
17. Click on the arrow leading to the user task from the exclusive gateway and enter the
following condition in the M
​ ain config t​ ab.
○ ${vacationApproved == 'false'}

18. Next, click on the mail task and go to the ​Main Config t​ ab of the ​Properties​ panel. Fill in
the following fields:
○ To: a ​ [email protected]
○ From: ​[email protected]
○ Subject: ​Leave approved!
○ Non html: H ​ i {$employeeName}, your leave request is approved.

Note that the sender email address specified here needs to be defined in the activiti.xml file as
well. You will see the instruction for that step later in this labkit.

If you are using Gmail to try out this scenario, enable IMAP access for Gmail. For more information,
see E​ nable IMAP settings in Gmail​.

If you receive an authentication error, you may have to adjust your account access settings in Gmail
as well. For more information, see A​ llowing less secure apps to access your account​.
19. Click on the user task A
​ djust vacation request a
​ nd go to the M
​ ain Config​ tab. Set the
assignee as admin who was the initiator you set for the start event as well.

20. Go to the F
​ orm​ tab and add all the form fields you added for the form on the start event.
Add the following additional field as well.

Resend request

Id resendRequest

Name Resend vacation request to manager?

Type enum

Readable true

Writeable true
Required true

Form Values

Id true

Name Yes

Id false

Name No

The form properties should look like the following:

21. Click on the user task and add another exclusive gateway. One of the outgoing arrows
should lead to an ​endEvent​ and the other should lead to the R
​ eview leave request​ user
task.

22. Click on the arrow leading to ​Review leave request a


​ nd add the following condition on
the ​Main config t​ ab.
○ ${resendRequest == 'true'}

23. Click on the arrow leading to the endEvent and add the following condition on the ​Main
config​ tab.
○ ${resendRequest == 'false'}

24. Go to the P
​ ackage Explorer​ view of Eclipse found on the right side panel and right click
on the Activiti project. Select ​Create deployment artifacts​. This will create the
deployable LeaveApplicationProcess.bar file.

Deploying the BPMN Process


1. Configure the following properties under the processEngineConfiguration bean found in
the​ ​<EI_HOME>/wso2/business-process/conf/activiti.xml​ file with the
following values as seen below:
○ <property name="mailServerHost" value="smtp.gmail.com"/>
○ <property name="mailServerPort" value=""/>

2. Add the following properties to the


<EI_HOME>/wso2/business-process/conf/activiti.xml​ ​file under the
processEngineConfiguration​ bean:
○ <property name="mailServerDefaultFrom"
value="[email protected]"/>
○ <property name="mailServerUseSSL" value="true"/>
○ <property name="mailServerUsername"
value="[email protected]"/>
○ <property name="mailServerPassword" value="mailtask123"/>

3. Copy the following jar files into the <


​ EI_HOME>/lib​ ​directory and restart the server.
○ org.apache.commons:commons-email:jar:1.3
○ javax.mail:mail:jar:1.4.7
○ javax.activation:activation:jar:1.1
4. Log in to the Management Console. Go to ​Configure>Users and Roles>Add>Add New
User​. Create a user called manager and click ​Next​.

5. Assign the user to the a


​ dmin​ role and click ​Finish​.
6. Go to the M
​ ain​ tab and click on ​Add>BPMN​ under the P
​ rocesses​ section. Upload the
LeaveApprovalProcess.bar file.

7. Now login to the ​BPMN explorer​ using admin/admin credentials and go to the
PROCESSES​ tab.

8. Click on the ​Start​ button to initiate this process. You will be presented with the
following form. Fill in the fields and click S
​ tart​.
○ Initiate the process twice (repeat step 8) so that you can view the response of
both leave approval and leave rejection.

9. Now log out and log in again using manager/manager credentials. Go to the​ TASKS>MY
TASKS t​ ab. The following task will be listed twice.
10. Click on the task, ​approve​ it and click ​Complete Task​.

11. Click on the other task, r​ eject​ it and click C


​ omplete Task.
12. Since you have approved one request now, log in to your email account. You should
have received a mail with the subject line “Leave approved!”. This is the response of the
leave request you approved.

13. Logout and login with admin/admin credentials. You will see an ​Adjust vacation request
task in the ​MY TASKS t​ ab of the BPMN explorer to resend the leave application. This is
the

14. If you fill in the ​Adjust vacation request​ form and click C
​ omplete Task​, the manager will
receive another new task to check the vacation request that was re-sent. Else, the
process will end.
15.
response of the leave request you rejected as a manager.

Boundary events and Signal Events

Let’s try to improve the BPMN process that you just developed to understand a few other
concepts in BPMN.

1. Let’s assume that the approval of the leave request should be done by the manager
within a certain time period and If it is not done, it should be escalated. You can use
Timer boundary events in such scenarios. Drag and drop a T
​ imerBoundaryEvent​ from
the ​Boundary Event​ tab of the tool palette, and place it above the ​Review leave request
user task.
2. Now click on the T
​ imer​ event and go to the ​Main config​ section of the ​Properties​ tab.
Change the C
​ ancel activity​ field to false since you are not going to cancel the existing
user task. Enter the T
​ ime Duration​ within which you want the escalation to happen in
ISO_8601​ format (eg:PT60S).

3. Add a new ​Mail task w


​ hich will be the task used to send an escalation email. Fill in the
fields with an appropriate mail subject and description and specify the to and from
values.
4. Add an outgoing flow from the signal event to this Mail task.

5. Since we need to terminate this execution path after sending the escalation mail, add a
Terminate end​ event from the tool palette to the outgoing flow from the Mail task.
6. The fully completed BPMN flow will look like the flow seen below. Deploy the BPMN
process as explained earlier in this labkit.

7. There will now be two versions of this process. Try starting a new process and wait
without completing the R
​ eview leave request ​task for the time duration you defined in
the timer event. You will receive the escalation email. You can continue the rest of the
steps in the process similar to the previous BPMN process.

There are situations where you can have some other additional external tasks to this process,
which should be done depending on the status of this process. Signal events can be used to
pass information about an event in a BPMN process.

1. First register a new ​Signal definition​ for your process. Go to the ​Signals​ section on the
Properties​ tab of the process. Click on an empty area in the editor to get the properties
view of the process.
2. Click the N
​ ew​ button to add a new signal definition. Add a signal with the following
attributes.
○ ID​ - leaveSignal
○ Name​ - Leave Signal
○ Scope ​- Global

3. Drag and drop a ​SignalThrowingEvent​ element from the I​ ntermediate Event t​ ab of the
tool palette to the canvas.
4. Click on the ​SignalThrowingEvent​ element to go to it’s P
​ roperties​ tab. Ensure that the
leaveSignal​ is selected as the S
​ ignal ref i​ n the ​Main config​ section.
5. Edit the outgoing flow from the Exclusive gateway to the Mail task so that it goes
through the ​SignalThrowingEvent​ as shown below.

6. Now, a signal will be thrown whenever a leave is approved. Let’s add another process
to catch this signal.
7. Drag and drop a ​SignalStartEvent​ to the canvas from the ​Start​ e
​ vent​ tab of the tool
palette.

8. Click on the ​SignalStartEvent​ element and go to the M


​ ain config​ section of the
Properties​ tab. Ensure that the l​ eaveSignal​ is selected as the ​Signal ref​.
9. Add a new User task with the name “Update records” similiar to what you did in the
first example, at the outgoing flow of the ​SignalStartEvent​.

10. Go to the F
​ orm​ section of the ​Properties​ tab of the User task. Add form elements with
the following values, like you did in the previous example. This time make the “writable”
false and put M
​ anager​ as the A
​ ssignee​ on the ​Main config​ section.
Number of days

Id numberOfDays

Name Number of days

Type long

Readable true

Writeable false

Required true

Start Date

Id startDate

Name First day of holiday (dd-MM-yyyy)

Type string

Date Pattern dd-MM-yyyy hh:mm

Readable true

Writeable false

Required true

Employee Name

Id employeeName

Name Name of employee

Type string

Readable true

Writeable false

Required true
11. Add an ​End event​ to the outgoing flow of the user task.

12. The fully completed BPMN diagram will look like the flow below. There are two
processes here.

13. Now deploy the sample again. Start a process instance with the latest version of the
process. There will be a new user task for the manager user with name “Update
records” if the leave approval has been approved.
Lab: BPEL Process Creation

Training Objective
Learn how to create BPEL processes.

Business Scenario
A client goes to a bank with the required documents in order to request a loan. The service
party (the bank) first retrieves the customer information and his history. Depending on that
data, it will calculate the credit rating for the loan request. Considering both the calculated
credit rating and the client history data, the bank will update the client with the final decision on
the loan request.

According to this scenario, this entire process is a combination of other synchronous and
asynchronous processes. A synchronous process is where that process would wait until a
response is received from an external party before proceeding to the next step.

Given that definition, we can see the following synchronous processes in the above scenario.

1. Getting client history data


2. Calculating the credit rating

For a process where the response takes too long to respond, we can use an asynchronous
process where we can continue the rest of the process flow, without having to wait until the
response is received.
High Level Steps
● Creating a BPEL process (synchronous and asynchronous)with correlation
● Creating a Synchronous process
● Creating an Asynchronous process
● Adding correlation
● Deploying the BPEL process

Detailed Instructions
BPEL Process Creation with Correlation
Follow the instructions below to present this scenario with a BPEL process.

1. Open E ​ clipse​ and click D


​ eveloper Studio​>O
​ pen Dashboard​.
2. Click the B​ PEL Workflow​ option.
4. Select C
​ reate New BPEL Workflow​.

5. Create a synchronous BPEL process named BankLoanProcess and click ​Finish​.


6. Unzip the​ ​LoanProcess.zip​ ​file in the
<EI_HOME>/samples/business-process/bpel​ ​directory.

7. Right-click on the ​bpelContent​ folder found under the ​BankLoanProcess​ and click
Import​.

7. Select ​WSDL​ and click N


​ ext​.

8. Import the external wsdl services​ ​CustomerInfo.wsdl​,


CreditRatingService.wsdl​ ​and​ ​LoanService.wsdl​ ​files from the
LoanProcess​ ​folder that you unzipped.
9. Now, you should define the type (schema) of the initial request and final response that
the BankLoanProcess BPEL service would require. In order to do that, double click on
BankLoanProcessArtifacts.wsdl and go to the D
​ esign​ view.

10. Click ​BankLoanProcessRequest​.

11. In the ​Properties​ tab, click the ​Element ​drop down field and click B
​ rowse​.

12. Select ​Enclosing Project ​to display the schema types including those that are listed in
the loan.xsd file. Select L
​ oanRequest​ as the input of the bpel process.
13. Similarly for the output, select ​LoanOffer​ in the E
​ lement​ field.

14. Next, right-click on the small connecting box of the above diagram and then click
Generate Binding Content​. Click ​Finish​. (Make sure that SOAP is selected in the
Protocol​ field)
15. Save the changes.

Creating a Synchronous Process


1. Open the design view of BankLoanProcess.bpel.

2. Now you can create the process flow. The first step is to receive the loan request from
the client. Right-click on the default available ​receiveInput step at the top, and click
Show Properties​. In the D
​ etails​ tab, make sure that ​client​ is selected as the partner link.
3. Add an ​Invoke step to invoke the CustomerInfo partner service. Right-click on the box
surrounding the ​receiveInput diagram and click ​Insert Before > Invoke​.

4. Go to the D
​ escription​ tab and enter InvokingCustomerInfo on the ​Name​ field.

5. Next, add a partner link in order to invoke this external service. Select
InvokingCustomerInfo and go to the ​Details tab of the ​Properties window. Click the
half arrow on the ​Partner Link​ field and select C
​ reate Global Partner Link​.
6. Enter CustomerPL as the P
​ artner Link Name​.

7. Select ​From Project as the partner link type and then select ​CustomerInfo in the
Matches​ field and click ​OK​.

8. Keep your cursor on the ​Operation field and double-click on ​getCustomerSSN which
will auto update the input/output of the invoke step.
9. Save the project.

In order to use this ​Invoke​ step, you need to have the input data that was provided by the client
from the previous receiveInput step. In order to get this input data applied to this I​ nvoke​ step’s
CustomerPLRequest, you need to add an ​Assign​ step right before this ​Invoke​ step.

10. Add an ​Assign​ step before the ​Invoke​ step.

11. Go to the D
​ etails​ tab of the ​Properties​ panel and click N
​ ew​.

12. Click on your input message in the F


​ rom​ field,expand
BankLoanProcessRequestMessage​ and select ​CustomerInfo​.
13. In the ​To​ field expand C
​ ustomerPLRequest​ and select ​part:CustomerInfo​ and save. At
this point you will be prompted to initialise the variable, make sure to click ​Yes​.

14. Click ​New​ again and create variable to variable options to map each part of the
CustomerInfo input (CustomerInfo:CustomerInfoType) to the corresponding part of
CustomerPLRequest (part:CustomerInfo) as seen below.
○ Note: Click save after each creation, to avoid errors.
15. Add another invoke step after the i​ nvokeCustomerInfo ​step. Name the step
InvokeCreditRating and go to the D​ etails​ tab of the ​Properties​ panel.

16. Next, you need to create a new partner link for the BPEL process to connect to the
CreditRatingService. Create another new global partner link and name it CreditPL.

17. Select ​From Project as the partner link type and then select ​CreditRating in the
Matches​ field and click ​OK​.

18. Once CreditPL is listed in the ​Quick Pick​ view, double click on the g
​ etCreditRating
method which will automatically add the input/output for this invoke.
19. You need to map the required data received from the CustomerInfo service, to the
InvokeCreditRatingRequest similar to the mapping you did before. Add a new ​Assign
step right before the I​ nvokeCreditRating​ step.

20. Go to the ​Details tab, click ​New and start by mapping the
CustomerPLResponse:CustomerSSN part to the CreditPLRequest:CustomerSSN part.
Click ​Yes​ when prompted to initialise.

21. Map each part and click S


​ ave​ (in this case, there is only one part: SSN).

Creating an Asynchronous Process


22. By this step we have configured both synchronous processes within the BPEL process.
Next, you have to send the acquired credit rating and client history data to the
LoanService in order to get the final decision on the loan request.

23. Right-click and select ​Add>Sequence ​to add a Sequence step after the
InvokeCreditRating step.

24. Right-click inside the sequence step and select ​Add>Invoke. ​Name the invoke step
InvokeLoanService.
25. Select this step and go to the ​Details tab on the ​Properties panel. Create a new Global
Partner Link called LoanPL.
26. Select ​From Project as the partner link type, then select ​LoanServicePT in the ​Matches
field and click O
​ K​.

27. You will be prompted to select a role. In this invoke step, you need to invoke the
getLoanOffer process therefore, you need to select the role that includes the
getLoanOffer operation. In this case, select the ​LoanServiceRole partner role and click
OK​.
28. Once the partner link is created, double click on the ​getLoanOffer operation from the
Quick Pick​ view and the input request will be added automatically.

29. Add a new ​Receive step in order to capture the result of the LoanService whenever it is
sent back to the BPEL process. Right-click inside the Sequence box and select
Add>Receive​. Name it ReceiveLoanOffer.
30. You need to use the ​OnLoanOffer ​operation found in the LoanServiceCallBackPortType
partner role for the receive step. This means that you need to use the ​LoanPL partner
link you created previously for this receive step as well. Click on ​LoanPL on the ​Outline
panel found on the top right corner of the Eclipse window.

31. In the ​Properties panel, check if ​LoanServiceClientRole is selected as My Role and


LoanServiceRole is selected as ​Partner Role​. Also check if the ​onLoanOffer ​and
getLoanOffer operations are listed respectively. This check is important to continue the
rest of this process.

32. Select the ReceiveLoanOffer step and select ​LoanPL as the ​Partner Link ​on the ​Details
tab of the ​Properties ​panel. Double-click on the ​onLoanOffer operation and an input of
the getLoanOfferResponse message type will be created. You can find it in the
Variables​ panel.
33. Since the variable is technically the response from the loan service to the BPEL process,
you can rename it to LoanPLResponse.

34. Assign the LoanPLResponse values to the final output variable of the BPEL process.
Add a new ​Assign step and map each variable of the
LoanPLResponse:getLoanOfferResponse part to the ​output:
BankLoanProcessResponseMessage part. Remember to initialize the variable and click
Save ​after each mapping.
35. Finally, select the ​replyOutput step and go to the ​Details tab on the ​Properties panel.
Check if it has a client partner link included.

36. Add an assign activity before the invokeLoanService activity and configure copying of
values like we did before. The following image shows the entire BPEL process as seen in design
view.
Adding a Correlation
With the BPEL process you just created above, 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. 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. Follow the instructions below to add a correlation to this process.

1. Select the r​ eceiveInput​ step of the BPEL process. Click the + sign on the C
​ orrelation
Sets​ panel found on the right side tool palette, to add a new correlation.
2. Select ​CorrelationSet a
​ nd click A
​ dd​ on the D
​ etails​ tab of the ​Properties​ panel. The
resulting window will show you a dialog box. Click N ​ ew​.

3. On the resulting dialog box, enter “id” as the ​Name a


​ nd click ​Browse​.

4. Under the ​Matches​ section, select the string schema as seen in the image below and
click O
​ K​.

5. Next, you need to map this correlation property to the matching property of your
receiveInput​ request, to act as the alias for correlation. Click the ​New​ button found next
to the ​Aliases​ section.
6. Select ​Message Type​ and click B
​ rowse​.

7. Select ​From Imports​ and filter by M


​ essages​.​ S
​ elect ​BankLoanProcessRequestMessage
and then select ​CustomerID​ under CustomerInfo.

8. Select the r​ eceiveInput​ step and go to the C


​ orrelation​ tab of the P
​ roperties​ panel. Click
Add​ to add the correlation set you just created. Set the Initiation to Y ​ es​.

9. Select the R
​ eceiveLoanOffer​ step, go to the C ​ orrelation​ tab and click Add to add the
correlation to this step as well. Set the Initiation to ​No​.
Deploying the BPEL Process
1. Expand the BPEL process project on the Project Explorer and open the ​deploy.xml​ file.

2. Specify the relevant ports of the partner links as seen below.


● Inbound Interfaces
Partner Link Associated Port

client BankLoanProcessPort

LoanPL LoanServiceCallbackPort

● Outbound Interfaces
Partner Link Associated Port

CustomerPL CustomerInfoPort

CreditPL CreditRatingPort

LoanPL LoanServicePort

3. Right-click on the BPEL process on the Project Explorer and select ​Export Project as
Deployable Archive​. Specify a location to export the .zip file to and click ​Finish​.

4. Start the WSO2 EI server and login to the management console.


5. Go to ​Add>BPEL​ under the P
​ rocesses​ section of the ​Main​ tab and upload the .zip file
you exported.

6. Before we try out the sample we need to have the three back-end services
(​CustomerInfoService, CreditRatingService, LoanService​) which are invoked from the
BankLoanProcess. Deploy the following processes from
<EI_HOME>/samples/business-process/bpel folder.
○ CustomerInfo.zip
○ CreditRating.zip
○ LoanService.zip

7. Go to ​List>BPEL​ and click on the process ID of the Bank Loan BPEL process you
uploaded.

8. Select ​client​ as the ​Partner Link​ and click ​Try It​. You can now invoke it with input
values.
Lab: Human Task

Training Objective
Learn how to work with Human Tasks.

Business Scenario
The ClaimsApprovalTask sample is a BPEL process that accepts claims approval requests. For
instance, consider an employee submitting a medical claim for spectacles. If the claim aproval
amount is greater than 1000, the process requires human interaction for the claim approval.

High Level Steps


● Creating the Required Roles and Users
● Deploying the Sample
● Running the Sample
Detailed Instructions
Creating the Required Role and User
1. In the BPS management console, go to C
​ onfigure > Users and Roles > Add​, and then
click A
​ dd New Role​.

2. Enter ​regionalClerksRole​ for the role name and click ​Next​.

3. Select ​All Permissions t​ o give all permissions to the role created and click ​Finish (​ the
user will be added later).
4. Go to ​Configure > Users and Roles > Add​, and then click ​Add New User​.

5. Enter regionalClerkUser for the user name and enter any password, and click N
​ ext​.

6. Select the r​ egionalClerksRole​ and click ​Finish​.

7. Similarly, create a ​regionalManagerRole​ and a ​regionalManagerUser​. Assign the


regionalManagerUser​ to the r​ egionalManagerRole​.

You are now ready to deploy the sample.

Deploying the Sample


You can now deploy the ClaimsApprovalTask sample by adding the tasks and process
associated with the sample.

1. Go to ​Main > Human Tasks > Add​.

2. Browse to ​<EI_HOME>/samples/business-process/humantask​ ​directory and


select the ​ClaimsApprovalTask.zip​, then click U
​ pload​.

3. Click OK o
​ n the confirmation message and then refresh the page.
The ApproveClaim and ClaimApprovalReminder task definitions will appear in the
deployed task configurations list.

4. You can click a task definition to view it. The ApproveClaim task definition looks like this:

5. Next, you need to add the process.

6. Go to ​Main > Processes > Add > BPEL​.

7. Browse to and select ​ClaimsApprovalProcess.zip​, which is located


in <
​ EI_HOME>/samples/business-process/bpel​ ​directory, and c​ lick Upload​.

8. Click ​OK​ on the confirmation message, wait a few moments, and then refresh the page.
The ClaimsApprovalProcess process is now deployed and appears in the ​Deployed
Processes l​ ist.

Running the Sample


Follow the steps below to run the sample.

1. Go to ​Main > Processes > List > BPEL​.


2. In the Process ID column, click the process ID for
ClaimsApprovalProcess:{​http://www.wso2.org/humantask/claimsapprovalprocess.bpel}
ClaimsApprovalProcess-1​. The ​Process Information​ screen appears, displaying
information about this process

3. In the ​WSDL Details​ section, select ​claimsApprovalPartnerLink​ from the Partner-Links


list, and then click T
​ ry It​.
A new browser window appears where you can replace the placeholder values with the
values you want to send.

4. Replace the sample with the following values:


body>
<p:ClaimApprovalProcessInput
xmlns:p="http://www.wso2.org/humantask/claimsapprovalprocessservice.ws
dl"><xsd:custID
xmlns:xsd="http://www.wso2.org/humantask/claimsapprovalprocessservice.
wsdl">customerId</xsd:custID>
<xsd:custFName
xmlns:xsd="http://www.wso2.org/humantask/claimsapprovalprocessservice.
wsdl">customerFName</xsd:custFName>
<xsd:custLName
xmlns:xsd="http://www.wso2.org/humantask/claimsapprovalprocessservice.
wsdl">CustomerName</xsd:custLName><xsd:amount
xmlns:xsd="http://www.wso2.org/humantask/claimsapprovalprocessservice.
wsdl">5000</xsd:amount>
<xsd:region
xmlns:xsd="http://www.wso2.org/humantask/claimsapprovalprocessservice.
wsdl">reagon</xsd:region>
<xsd:priority
xmlns:xsd="http://www.wso2.org/humantask/claimsapprovalprocessservice.
wsdl">1</xsd:priority>
</p:ClaimApprovalProcessInput>
</body>
5. Click ​Send​.

6. You can now view this process instance in the management console. Go to ​Main >
Instances > BPEL​. Notice that the ClaimsApprovalProcess-1 instance has been created
and is active.

7. Click ​Instance ID​ to view the activity flow.

The flow of the process depends on the value you specified for the amount property. If
the amount is less than 1000, the BPEL process handles the approval and the process
terminates without initiating the human task. If the amount is over 5000, the
ClaimsApprovalTask is initiated, and the process waits until it receives approval from
the human task activity. To view this task, you must log in as the user who is assigned
to this task.

8. Log in to the ​Human Task Explorer ​as the ​regionalClerkUser​.

9. The task appears in the ​MY TASKS t​ ab. Click on the task to view task details.

10. Click ​Start​ to start the task.


11. To approve the request, select ​Approved​ in the L ​ oan Approval Status​ section, and then
click C
​ omplete​.​ Click ​Yes​ on the confirmation message.

12. Go to ​Main > Business Processes > Instances​. You can see that the instance, which
was previously waiting for approval, has now completed successfully.

You might also like