OracleArea51

Sponsored By Chola Global Services LLC

Using Human Task Actitvity in BPEL

E-mail
(6 votes, average 4.17 out of 5)
Human Task is one of the process activity in  a BPEL process. Human task as the name suggests is used where we need human intervention. So whereever there is a need for human to do some job we use the human task. Here in this example we will see a Order Approval process where a person needs to approve or reject a order.

Initial Steps


1.Right Click on Applications.Select New.Go to General->Workspaces->Workspace.
workspace
2.Name the workspace as HumanTaskDemo.Un check the Add new project.

3.Right click on HumanTaskDemo and select New. Selet New BPEL Project.
4.Name the project as HumanTaskDemo and select ASynchronous process.
h1
5.Save your work.Copy OrderBookingPo.xsd file and order.xsl from C:\OraBPELPM_3\integration\orabpel\samples\tutorials\127.OrderBookingTutorial\PracticeFiles and paste it in your working folder(C:\OraBPELPM_3\integration\jdev\jdev\mywork\HumanTaskDemo)

6.Right click on Project Schemas in the Structure Navigator and select Import Schemas.Click on the torch icon and select the OrderBooking xsd file from your project folder
.schema
Verify that OrderBookingPO.xsd appears under OrderApproval > Web Content> Miscellaneous Files in the Applications Navigator section of the designer window. OrderBookingPO.xsd also appears under Project Schemas in the Structure section.
schma2
7. Expand Message Types > Process WSDL - OrderApproval.wsdl >OrderApprovalRequestMessage > payload in the Structure section.
8. Right-click payload and select Edit Message Part to display the Edit Message Part window.
9. Select Element and click the flashlight icon to the right of the Element field.
h4
10. Expand Project Schema Files > OrderBookingPO.xsd.

11. Select PurchaseOrder.Click OK to close the Type Chooser window and the Edit Message Part window.This defines the input parameter (payload) of the PurchaseOrder type.
12. Expand Message Types > Process WSDL - OrderApproval.wsdl >OrderApprovalResponseMessage > payload in the Structure section.
13. Right-click payload and select Edit Message Part to display the Edit Message Part window.
13. Select Element and click the flashlight icon to the right of the Element field.
14. Expand Project Schema Files > OrderBookingPO.xsd.
15. Select PurchaseOrder.
16. Click OK to close the Type Chooser window and the Edit Message Part window.
This defines the output parameter (payload) of the PurchaseOrder type.
17. Save your work.

Human Task


18.Drag and drop a User Task activity from the Component Palette section to below
the receiveInput Receive activity.

19.Leave the Create New Workflow check box selected and click Next.
h2
20.Select Sequential Workflow from the Workflow Patterns list and click Next.
h3
21.Click the icon to the right of the Task Title field to display the XPath Expression
Builder window.

22.add the following in the Expression Builder: this is used for concating the string Order no: with the CustId.

concat(string('Order No:'),bpws:getVariableData('inputVariable','payload','
/ns1:PurchaseOrder/ns1:ID'),string(' for '),bpws:getVariableData
('inputVariable','payload','/ns1:PurchaseOrder/ns1:CustID'))
h5
23.Click the flashlight icon to the right of the Payload field to display the Variable
XPath Builder window.

24.Expand and select Process > Variables > inputVariable > payload >ns1:PurchaseOrder.h7
25. Click OK.
The following information displays in the Payload field:
bpws:getVariableData('inputVariable','payload','/ns1:PurchaseOrder')
26.Click XSL File and select Order.xsl. This is the XML style sheet for the payload
display.

27.Select 10 for the Minutes field of the Expiration Duration section.Click Next
h6
28.Leave the two default outcomes as ACCEPT and REJECT.
h8
29.Accept the default settings and click Next.
h9
30.Select Management chain and click Next.
h10
Select Assign to Group.select Group and click the flashlight icon.
h11
31.Click Lookup. Note that it can take a few seconds for names to appear.
32.Select Supervisor and click Select.
The Supervisor role appears in the Selected group field.Click Ok.

h12
33.Enter 1 in the Number of levels field.Click Next.
h13
34.Select ACCEPT as the conclusion that results in the task being routed.Click Next and then finish.


A Scope activity and Switch activity are automatically created.
h15

Assign Activity



35.Drag and drop an Assign activity from the Component Palette section to below the copyPayloadFromTask Assign activity in the <case Task outcome is ACCEPT> section of the Switch activity.
36. Double-click the assign icon to display the Assign window.
37. Click the General tab.
38. Enter assignOrderApproval1 in the Name field.
39. Click Apply.
40. Click the Copy Rules tab.
41. Click Create to display the Create Copy Rule window.
42. Enter following details:In the from choose Expression from the dropdown and enter Accepted.Click ok and in the To select and expand Variables > inputVariable > payload >ns1:PurchaseOrder > ns1:OrderInfo > ns1:OrderComments
h16
43.Similarly for the other cases repeat the above steps and enter as Rejected in the expression.
h17
44.Drag and drop an Assign activity from the Component Palette section to below
(outside) the Switch activity.Double-click the Assign icon to display the Assign window.
45. Click the General tab.
46.Enter setOutputVariable in the Name field.
47.Click Apply.
48.Click the Copy Rules tab.
49.Click Create to display the Create Copy Rule window.
In the To Section : Expand and select Variables > inputVariable > payload >ns1:PurchaseOrder
In the From section: Expand and select Variables > outputVariable > payload >ns1:PurchaseOrder
h18

Deploy and Test the process


Right click on the project and click Deploy->Local BPEL Server->Deploy to default Domain. Specify the password as bpel.

You will get a message as deployed sucessfully.Login to the BPEL console and you can see the HumanTaskDemo deployed.Click on that.Select XML source from Initiate a test instance.
h19
Copy the contents of the OrderbookingPO_2.xml file and paste it in the box.

If you go to the Audit tab and check the values you will see that the last activity is in pending since the order has not been approved or rejected.
h23
Select Start > All Programs > Oracle - Oracle_Home > Oracle BPEL ProcessManager 10.1.2 > Sample Worklist Application to access the login window for the Oracle BPEL Worklist:
Log in as jcooper/welcome.
This displays the Oracle BPEL Worklist window. A task waiting to be approved appears. Select Acquire in the Actions list for the task to approve. Click Go.
h20

h21
Log out as user jcooper. Log into the Oracle BPEL Worklist as jstein/welcome. Select Accept from the Actions list and click Go.
h22
After processing, no tasks now appear in the Oracle BPEL Worklist.Return to the Oracle BPEL Console.Click the Instances tab at the top.Click the HumanTaskDemo instance.A message appears indicating that the instance has completed.Click the Audit and Flow links to observe additional details about the completed OrderApproval process.
h25
Click on the last process and you can notice that the ordercomment has the value accepted.
h24


Aarthi Sudhakar
Points: 1501
Contact Author | Website :
 

Related Posts:

relatedArticles
Trackback(0)
Comments (0)add comment

Write comment

busy