Oracle® BPEL Process Manager Order Booking Tutorial
10g Release 2 (10.1.2) B15813-02 |
|
Previous |
Next |
This chapter of the tutorial describes how to add user tasks to handle the manual approval or rejection of a purchase order.
This chapter contains the following topics:
This phase of the tutorial adds to the process you designed in Chapter 10, "Designing the Database Adapter to Insert Data". Ensure that you have successfully completed that phase before performing this one. This phase extends the previous project steps by calling an external manual service through human task capabilities. It includes a call out to another web service that handles human tasks and uses predefined (default) graphical user interface screens for user actions. You perform the following key tasks:
Create a new BPEL process named OrderApproval.
Design the BPEL process to add workflow functionality to handle the manual approval or rejection of a purchase order.
Deploy the OrderApproval BPEL process.
Run the OrderApproval BPEL process from Oracle BPEL Console.
Access the Oracle BPEL Worklist Application URL to approve the order.
Return to the OrderBooking BPEL process and create a partner link (named POAService) that interacts with the OrderApproval BPEL process.
Design the BPEL process to invoke POAService.
Deploy the OrderBooking BPEL process.
Run the OrderBooking BPEL process from Oracle BPEL Console.
Access the Oracle BPEL Worklist Application URL to approve the order.
This section contains these topics:
In this phase of the tutorial, you create a new project and define the human workflow service project.
This section contains these tasks:
Right-click OrderBookworkspace in the Applications Navigator section of the designer window.
Select New Project.
Double-click BPEL Process Project in the Items window to display the BPEL Process Project window.
Enter OrderApproval in the BPEL Process Name field. All other fields default to the correct values for creating an asynchronous BPEL process.
Click OK.
Copy OrderBookingPO.xsd
, OrderBookingPO_1.xml
, and Order.xsl
from the ORACLE_HOME
\integration\orabpel\samples\tutorials\127.OrderBookingTutorial\PracticeFiles
directory to the ORACLE_HOME
\integration\jdev\jdev\mywork\OrderBookworkspace\OrderApproval
directory.
Double-click OrderApproval.bpel in the Applications Navigator section of the designer window.
Select and right-click Project Schemas in the Structure section.
Select Import Schema.
The Import Schema window appears.
Click the flashlight icon to access the Open window.
Select OrderBookingPO.xsd from the OrderApproval directory in which you placed it in Step 1 and click Open.
The file is added to the URL field of the Import Schema window.
Click OK.
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.
Expand Message Types > Process WSDL - OrderApproval.wsdl > OrderApprovalRequestMessage > payload in the Structure section.
Right-click payload and select Edit Message Part to display the Edit Message Part window.
Select Element and click the flashlight icon to the right of the Element field.
Expand Project Schema Files > OrderBookingPO.xsd.
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.
Expand Message Types > Process WSDL - OrderApproval.wsdl > OrderApprovalResponseMessage > payload in the Structure section.
Right-click payload and select Edit Message Part to display the Edit Message Part window.
Select Element and click the flashlight icon to the right of the Element field.
Expand Project Schema Files > OrderBookingPO.xsd.
Select PurchaseOrder.
Click OK to close the Type Chooser window and the Edit Message Part window.
This defines the output parameter (payload) of the PurchaseOrder type.
Select Save from the File main menu.
Ensure that Process Activities is selected in the drop-down list of the Component Palette section.
Drag and drop a User Task activity from the Component Palette section to below the receiveInput Receive activity.
This starts the Workflow Wizard.
Leave the Create New Workflow button selected and click Next.
The Workflow Pattern window appears.
Select Sequential Workflow from the Workflow Patterns list and click Next.
The Task Details window appears.
Click the icon to the right of the Task Title field to display the XPath Expression Builder window.
Press Ctrl and then the space bar to add the following in the Expression Builder field:
concat(string('Order No:'),bpws:getVariableData('inputVariable','payload',' /ns1:PurchaseOrder/ns1:ID'),string(' for '),bpws:getVariableData ('inputVariable','payload','/ns1:PurchaseOrder/ns1:CustID'))
Click OK when complete to return to the Task Details window.
Click the flashlight icon to the right of the Payload field to display the Variable XPath Builder window.
Expand and select Process > Variables > inputVariable > payload > ns1:PurchaseOrder.
Click OK.
The following information displays in the Payload field:
bpws:getVariableData('inputVariable','payload','/ns1:PurchaseOrder')
Click XSL File and select Order.xsl. This is the XML style sheet for the payload display.
Leave the Task Creator field empty.
Select 10 for the Minutes field of the Expiration Duration section.
Click Next.
The Task Outcomes window appears.
Leave the two default outcomes as ACCEPT and REJECT.
Click Next.
The Task Notifications window appears.
Accept the default settings and click Next.
The Assignment Policy window appears.
Select Management chain and click Next.
The Assignees window appears.
Select Assign to Group.
Select Group and click the flashlight icon.
The Identity Lookup dialog window appears.
Click Lookup. Note that it can take a few seconds for names to appear.
Select Supervisor and click Select.
The Supervisor role appears in the Selected group field.
Click OK.
Supervisor appears in the Group field.
Click Next.
Enter 1 in the Number of levels field.
Leave the remaining field blank on this window.
Click Next.
The Routing policy window appears.
Select ACCEPT as the conclusion that results in the task being routed.
Leave the remaining field blank on this window.
Click Next.
The Finish window displays your selections for workflow name, pattern, and outcome.
Click Finish.
A Scope activity and Switch activity are automatically created.
Both activities contain the details you entered in the Workflow Wizard.
Select Save from the File main menu.
Summary: You now create an Assign activity that copies the payload back to its source. |
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.
Double-click the assign icon to display the Assign window.
Click the General tab.
Enter assignOrderApproval1 in the Name field.
Click Apply.
Click the Copy Rules tab.
Enter the following details:
Field | Value |
---|---|
From |
|
|
Expression |
|
string('Accepted') |
To |
|
|
Variable |
|
Select and expand Variables > inputVariable > payload > ns1:PurchaseOrder > ns1:OrderInfo > ns1:OrderComments
Note: The namespace number values (for example, ns1, ns2) can vary. Use the namespace values that automatically appear. |
Click OK to close the Create Copy Rule window and the Assign window.
Repeat Steps 1 through 9 to create an Assign activity below the copyPayloadFromTask Assign activity in the <case Task outcome is REJECT> section. Enter the same details as described above, with the following exceptions:
Name it assignOrderApproval2
Set the Expression field to string('Rejected')
Repeat Steps 1 through 9 to create an Assign Activity below the copyPayloadFromTask Assign activity in the <otherwise> section. Enter the same details as described above, with the following exceptions:
Name it assignOrderApproval3
Set the Expression field to string('Rejected')
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.
Click the General tab.
Enter setOutputVariable in the Name field.
Click Apply.
Click the Copy Rules tab.
Click Create to display the Create Copy Rule window.
Field | Value |
---|---|
From |
|
|
Variable |
|
Expand and select Variables > inputVariable > payload > ns1:PurchaseOrder
Note: The namespace number values (for example, ns1, ns2) can vary. Use the namespace values that automatically appear. |
To |
|
|
Variable |
|
Expand and select Variables > outputVariable > payload > ns1:PurchaseOrder |
Click OK to close the Create Copy Rule window and the Assign window.
When complete, the designer window looks as follows:
Select Save from the File main menu.
Go to the Applications Navigator section.
Right-click OrderApproval.
Enter the domain password of bpel when prompted.
This compiles the BPEL process. Review the bottom of the window for any errors. If there are no errors, deployment was successful. If deployment was unsuccessful, see Step 5.
Log into Oracle BPEL Console by selecting Start > All Programs > Oracle - Oracle_Home > Oracle BPEL Process Manager 10.1.2 > BPEL Console (or refresh the page if it is already open).
Click OrderApproval in the Deployed BPEL Processes list.
Enter details in all fields of the HTML Form. You can also use a text editor to copy and paste these details from the contents of the OrderBookingPO_1.xml
file:
Select XML Source from the Initiating a test instance list.
Copy and paste the contents of OrderBookingPO_1.xml
into the field that appears.
Click Post XML Message.
The BPEL Processes tab displays a message similar to the following:
Test Instance Initiated
Click the Instances tab at the top.
Click the OrderApproval instance.
A message appears indicating that the instance is active.
Select Start > All Programs > Oracle - Oracle_Home > Oracle BPEL Process Manager 10.1.2 > Sample Worklist Application to access the login window for Oracle BPEL Worklist Application:
Log in as jcooper
/welcome
.
This displays Oracle BPEL Worklist Application. A task waiting to be approved appears.
Select Acquire in the Actions list for the task to approve.
Click Go.
The task details and payload information appear. Since this task is configured to be approved by two users, the task is routed to jstein
, the manager of jcooper
if it is accepted. If the task is rejected, the OrderApproval process identifies the task as rejected and completes processing.
Review the information. For example, the following information appears if you copied and pasted in the contents of OrderBookingPO_1.xml
.
Select Accept from the Task Action list and click Go.
Log out as user jcooper
.
Log into Oracle BPEL Worklist Application as jstein
/welcome
.
Select Accept from the Actions list and click Go.
After processing, no tasks appear in Oracle BPEL Worklist Application.
Return to Oracle BPEL Console.
Click the Instances tab at the top.
Click the OrderApproval 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.
Summary: You now create a partner link for the OrderApproval service. |
Ensure that you are in the OrderBooking process.
Double-click OrderBooking.bpel.
Ensure that Process Activities is selected in the drop-down list of the Component Palette section.
Drag and drop a PartnerLink activity onto the right side of the designer window.
Enter the following values to create a partner link for the OrderApproval service:
Field | Value |
---|---|
Name | POAService |
WSDL File | Access this URL by clicking the WSIL Browser flashlight icon and expanding and selecting LocalBPELServer > processes > default > OrderApproval.
http://localhost:9700/orabpel/default/OrderApproval/OrderApproval?wsdl See Also: "Setting the Hostname in Your JDeveloper BPEL Designer Web Browser Preferences" if you receive a parsing error when attempting to add a WSDL file in the WSDL Chooser window. |
Partner Link Type | OrderApproval |
My Role | OrderApprovalRequester |
Partner Role | OrderApprovalProvider |
Click OK.
Select Save from the File main menu.
Summary: You now create a Scope activity to group all activities that form a logical step to be executed. |
Drag and drop a Scope activity from the Component Palette section to below the SelectSupplier Switch activity.
Double-click the scope icon to display the Scope window.
Enter UserApproval in the Name field of the General tab.
Click OK.
In this phase of the tutorial, you create the Invoke, Receive, and Assign activities inside this Scope activity.
Click the + sign to expand the Scope activity.
Select Save from the File main menu.
Drag and drop an Invoke activity from the Component Palette section into the UserApproval Scope activity.
Double-click the Invoke icon to display the Invoke window.
Enter the following details:
Field | Value |
---|---|
Name | invokePOAService |
Partner Link | POAService |
The Operation (initiate) field is automatically filled in.
Click the first icon to the right of the Input Variable field. This is the automatic variable creation icon.
Click OK on the Create Variable window that appears.
A variable named invokePOAService_initiate_InputVariable is automatically created in the Input Variable field. This variable is automatically assigned a message type of OrderApprovalRequestMessage.
Click OK.
Drag and drop a Receive activity to below the invokePOAService Invoke activity inside the UserApproval Scope activity.
Double-click the Receive icon to display the Receive window.
Enter the following details:
Field | Value |
---|---|
Name | receivePOAService |
Partner Link | POAService |
The Operation (onResult) field is automatically filled in.
Click the first icon to the right of the Variable field. This is the automatic variable creation icon.
Click OK on the Create Variable window that appears.
A variable named receivePOAService_onResult_InputVariable is automatically created in the Variable field. This variable is automatically assigned a message type of OrderApprovalResponseMessage.
Click OK.
Select Save from the File main menu.
Drag and drop an Assign activity from the Component Palette section to above the invokePOAService Invoke activity and inside the UserApproval Scope activity.
Double-click the Assign icon to display the Assign window.
Enter assignPOADataIn in the Name field of the General tab.
Click Apply.
Click the Copy Rules tab.
Click Create to display the Create Copy Rule window.
Field | Value |
---|---|
From |
|
|
Variable |
|
Expand and select Variables > inputVariable > payload |
To |
|
|
Variable |
|
Expand and select Variables > invokePOAService_initiate_inputVariable > payload |
Click OK to close the Create Copy Rule window and the Assign window.
Select Save from the File main menu.
Drag and drop an Assign activity from the Component Palette section to below the receivePOAService Receive activity and inside the UserApproval Scope activity.
Double-click the Assign icon to display the Assign window.
Enter UserResponse in the Name field of the General tab.
Click Apply.
Click the Copy Rules tab.
Click Create to display the Create Copy Rule window.
Field | Value |
---|---|
From |
|
|
Variable |
|
Expand and select Variables > receivePOAService_onResult_InputVariable > payload > ns1:PurchaseOrder > ns1:OrderInfo > ns1:OrderComments
Note: The namespace number values (for example, ns1, ns2) can vary. Use the namespace values that automatically appear. |
To |
|
|
Variable |
|
Expand and select Variables > inputVariable > payload > ns1:PurchaseOrder > ns1:OrderInfo > ns1:OrderStatus |
Click OK.
Click Create in the Copy Rules tab to again display the Create Copy Rule window.
Enter the following details to create a second statement:
Field | Value |
---|---|
From |
|
|
Expression |
|
concat(bpws:getVariableData('inputVariable','payload','/ns1:PurchaseOrder/ns1:OrderInfo/ns1:OrderComments'), ', User Review Complete') |
To |
|
|
Variable |
|
Expand and select Variables > inputVariable > payload > ns1:PurchaseOrder > ns1:OrderInfo > ns1:OrderComments |
Click OK to close the Create Copy Rule window and the Assign window.
When complete, the designer window looks as follows:
Click the - sign to close the UserApproval Scope activity.
Select Save from the File main menu.
Go to the Applications Navigator section.
Right-click OrderBooking.
Increment the version number of the project when prompted (for example, enter 1.7) and click OK.
This compiles the BPEL process. Review the bottom of the window for any errors. If there are no errors, deployment was successful. If deployment was unsuccessful, see Step 5.
Log into Oracle BPEL Console by selecting Start > All Programs > Oracle - Oracle_Home > Oracle BPEL Process Manager 10.1.2 > BPEL Console (or refresh the page if it is already open).
Click the BPEL Processes tab.
Note which OrderBooking version has an asterisk next to the version number. This is the default version.
Click the latest version number of the OrderBooking process. If you have been incrementing the version numbers as described in previous chapters, this is the highest number.
The Managing this BPEL Process window appears.
Scroll down and click Mark as Default to make this the default version of OrderBooking.
Click Done when prompted and note that this OrderBooking version now has an asterisk next to the version number, indicating that it is the default version.
If you have installed Patch 1, go to Step 8. Otherwise, you must first perform Steps 7a through 7b. See Chapter 1, "Introduction" for information about where to obtain Patch 1.
Click the Dashboard tab.
Verify that the processes are deployed (OrderApproval, OrderBooking, and all other processes, including TaskActionHandler). OrderApproval uses TaskActionHandler with a more sophisticated user interaction flow compared to the simpler TaskManager used by SelectManufacturing.
Start the correct OrderBooking version instance in one of the following ways:
Copy Oracle_Home
\integration\orabpel\samples\tutorials\127.OrderBookingTutorial\PracticeFiles
\OrderBookingPO_1.xml
to a temporary directory (drive_letter
:\temp
on Windows operating systems or /temp
on Unix operation systems).
Click the process and provide input to the default graphical user interface page in either of the following ways:
Enter details in all fields of the HTML Form and click Post XML Message.
Select XML Source from the Initiating a test instance list. Use a text editor to copy and paste the contents of the OrderBookingPO_1.xml
file into the field that appears. Click Post XML Message.
Open the provided CreateOrderBookingUI application at http://localhost:9700/CreateOrderBookingUI
and provide inputs to initiate a process.
Verify that the OrderBooking process has started.
Provide a price quote for SelectManufacturing from the following graphical user interface:
http://localhost:9700/SelectManufacturingUI
After providing a quote, watch the process instance execute and invoke the user approval service at OrderApproval. Go to Oracle BPEL Console and verify that the OrderApproval process and TaskActionHandler process have both started.
Select Start > All Programs > Oracle - Oracle_Home > Oracle BPEL Process Manager 10.1.2 > Sample Worklist Application to access the login window for Oracle BPEL Worklist Application.
Log in as jcooper
/welcome
. Default users are provided at install time in the following configuration file:
Oracle_Home\integration\orabpel\system\appserver\oc4j\j2ee\home\config\jazn-data.xml
The list shows the task awaiting user actions.
Select Acquire in the Actions list and click Go to acquire a task.
View the task details, the comments section, and so on.
Approve or reject the task by selecting Accept or Reject from the Task Action list, and click Go.
Log out of user jcooper
. Rejects go directly back to the process, while approved tasks require the next level of approval.
Log in as jstein
/welcome
(the default manager of jcooper
in the hierarchy defined in the jazn-data.xml
configuration file listed in Step 14).
The list shows the task awaiting user actions.
View the task details, the comments section, and so on.
Approve or reject the task in the Actions list and click Go.
After the jstein
comments, the approved tasks of jcooper
are returned to the process.
View Oracle BPEL Console, database tables, or temporary directory you specified (drive_letter
:\temp
on Windows operating systems or /temp
on Unix operation systems) for completion of the process (as examined in previous tutorial phases).
You have now added user tasks to handle the manual approval or rejection of a purchase order. This phase extended the previous project steps by calling an external manual service through human task capabilities. It included a call out to another service that handled human tasks and used predefined (default) graphical user interface screens for user actions. You performed the following key tasks:
Created a new BPEL process named OrderApproval.
Designed the BPEL process to add workflow functionality to handle the manual approval or rejection of a purchase order.
Deployed the OrderApproval BPEL process.
Ran the OrderApproval BPEL process from Oracle BPEL Console.
Accessed the Oracle BPEL Worklist Application URL to approve the order.
Returned to the OrderBooking BPEL process and created a partner link (named POAService) that interacted with the OrderApproval BPEL process.
Designed the BPEL process to invoke POAService.
Deployed the OrderBooking BPEL process.
Ran the OrderBooking BPEL process from Oracle BPEL Console.
Accessed the Oracle BPEL Worklist Application URL to approve the order.