Skip Headers
Oracle® BPEL Process Manager Order Booking Tutorial
10g Release 2 (10.1.2)
B15813-03
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

11 Designing the Human Workflow System

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:

11.1 Introduction

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:

11.2 Designing the Human Workflow System for Manual Approval of an Order

This section contains these topics:

11.2.1 Defining the Purchase Order Approval Service

In this phase of the tutorial, you create a new project and define the human workflow service project.

This section contains these tasks:

11.2.1.1 Creating a New Project

  1. Right-click OrderBookworkspace in the Applications Navigator section of the designer window.

  2. Select New Project.

  3. Double-click BPEL Process Project in the Items window to display the BPEL Process Project window.

  4. Enter OrderApproval in the BPEL Process Name field. All other fields default to the correct values for creating an asynchronous BPEL process.

  5. Click OK.

11.2.1.2 Importing a Project Schema

  1. 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.

  2. Double-click OrderApproval.bpel in the Applications Navigator section of the designer window.

  3. Select and right-click Project Schemas in the Structure section.

  4. Select Import Schema.

    The Import Schema window appears.

  5. Click the flashlight icon to access the Open window.

  6. 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.

  7. Click OK.

  8. 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.

  9. Expand Message Types > Process WSDL - OrderApproval.wsdl > OrderApprovalRequestMessage > payload in the Structure section.

  10. Right-click payload and select Edit Message Part to display the Edit Message Part window.

  11. Select Element and click the flashlight icon to the right of the Element field.

  12. Expand Project Schema Files > OrderBookingPO.xsd.

  13. Select PurchaseOrder.

  14. Click OK to close the Type Chooser window and the Edit Message Part window.

    This defines the input parameter (payload) of the PurchaseOrder type.

  15. Expand Message Types > Process WSDL - OrderApproval.wsdl > OrderApprovalResponseMessage > payload in the Structure section.

  16. Right-click payload and select Edit Message Part to display the Edit Message Part window.

  17. Select Element and click the flashlight icon to the right of the Element field.

  18. Expand Project Schema Files > OrderBookingPO.xsd.

  19. Select PurchaseOrder.

  20. Click OK to close the Type Chooser window and the Edit Message Part window.

    This defines the output parameter (payload) of the PurchaseOrder type.

  21. Select Save from the File main menu.

11.2.1.3 Creating a User Task Activity

  1. Ensure that Process Activities is selected in the drop-down list of the Component Palette section.

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

    This starts the Workflow Wizard.

  3. Leave the Create New Workflow button selected and click Next.

    The Workflow Pattern window appears.

  4. Select Sequential Workflow from the Workflow Patterns list and click Next.

    The Task Details window appears.

  5. Click the icon to the right of the Task Title field to display the XPath Expression Builder window.

  6. 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'))
    
    
  7. Click OK when complete to return to the Task Details window.

  8. Click the flashlight icon to the right of the Payload field to display the Variable XPath Builder window.

  9. Expand and select Process > Variables > inputVariable > payload > ns1:PurchaseOrder.

  10. Click OK.

    The following information displays in the Payload field:

    bpws:getVariableData('inputVariable','payload','/ns1:PurchaseOrder')
    
    
  11. Click XSL File and select Order.xsl. This is the XML style sheet for the payload display.

  12. Leave the Task Creator field empty.

  13. Select 10 for the Minutes field of the Expiration Duration section.

  14. Click Next.

    The Task Outcomes window appears.

  15. Leave the two default outcomes as ACCEPT and REJECT.

  16. Click Next.

    The Task Notifications window appears.

  17. Accept the default settings and click Next.

    The Assignment Policy window appears.

  18. Select Management chain and click Next.

    The Assignees window appears.

  19. Select Assign to Group.

  20. Select Group and click the flashlight icon.

    The Identity Lookup dialog window appears.

  21. Click Lookup. Note that it can take a few seconds for names to appear.

  22. Select Supervisor and click Select.

    The Supervisor role appears in the Selected group field.

  23. Click OK.

    Supervisor appears in the Group field.

  24. Click Next.

  25. Enter 1 in the Number of levels field.

  26. Leave the remaining field blank on this window.

  27. Click Next.

    The Routing policy window appears.

  28. Select ACCEPT as the conclusion that results in the task being routed.

  29. Leave the remaining field blank on this window.

  30. Click Next.

    The Finish window displays your selections for workflow name, pattern, and outcome.

  31. Click Finish.

    A Scope activity and Switch activity are automatically created.

    Both activities contain the details you entered in the Workflow Wizard.

  32. Select Save from the File main menu.

11.2.1.4 Creating Assign Activities Inside the Switch Activity


Summary:

You now create an Assign activity that copies the payload back to its source.

  1. 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.

  2. Double-click the assign icon to display the Assign window.

  3. Click the General tab.

  4. Enter assignOrderApproval1 in the Name field.

  5. Click Apply.

  6. Click the Copy Rules tab.

  7. Click Create to display the Create Copy Rule window.

  8. Enter the following details:


    Note:

    Instead of manually entering an expression, you can press Ctrl and then the space bar in the Expression field. Scroll through the list of values that appears and double-click the value you want. Edit the value as necessary. As you enter information, a trailing slash can appear. This means you are being prompted for additional information. Either enter additional information, or press the Esc key and delete the trailing slash to complete the input of information.

    Field Value
    From
    • Type
    Expression
    • Expression
    string('Accepted')
    To
    • Type
    Variable
    • Variables
    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.


  9. Click OK to close the Create Copy Rule window and the Assign window.

  10. 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')

  11. 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')

  12. Drag and drop an Assign activity from the Component Palette section to below (outside) the Switch activity.

  13. Double-click the Assign icon to display the Assign window.

  14. Click the General tab.

  15. Enter setOutputVariable in the Name field.

  16. Click Apply.

  17. Click the Copy Rules tab.

  18. Click Create to display the Create Copy Rule window.

  19. Enter the following details:

    Field Value
    From
    • Type
    Variable
    • Variables
    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
    • Type
    Variable
    • Variables
    Expand and select Variables > outputVariable > payload > ns1:PurchaseOrder

  20. Click OK to close the Create Copy Rule window and the Assign window.

    When complete, the designer window looks as follows:

    Description of obph10wf2.gif follows
    Description of the illustration obph10wf2.gif

  21. Select Save from the File main menu.

11.2.1.5 Validating, Compiling, and Deploying the Order Approval Process

  1. Go to the Applications Navigator section.

  2. Right-click OrderApproval.

  3. Select Deploy > LocalBPELServer > Deploy to default domain.

  4. 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.

11.2.1.6 Running the Order Approval Process

  1. 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).

    The Dashboard tab of Oracle BPEL Console appears.

  2. Click OrderApproval in the Deployed BPEL Processes list.

  3. 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:


    Note:

    Do not copy and paste from Internet Explorer or Mozilla Firefox. You must use a text editor to perform this task.

    1. Select XML Source from the Initiating a test instance list.

    2. Copy and paste the contents of OrderBookingPO_1.xml into the field that appears.

  4. Click Post XML Message.

    The BPEL Processes tab displays a message similar to the following:

    Test Instance Initiated
    
    
  5. Click the Instances tab at the top.

  6. Click the OrderApproval instance.

    A message appears indicating that the instance is active.

  7. 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:

  8. Log in as jcooper/welcome.

    This displays Oracle BPEL Worklist Application. A task waiting to be approved appears.

  9. Select Acquire in the Actions list for the task to approve.

  10. 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.

  11. Review the information. For example, the following information appears if you copied and pasted in the contents of OrderBookingPO_1.xml.

    Description of obph10task.gif follows
    Description of the illustration obph10task.gif

  12. Select Accept from the Task Action list and click Go.

  13. Log out as user jcooper.

  14. Log into Oracle BPEL Worklist Application as jstein/welcome.

  15. Select Accept from the Actions list and click Go.

    After processing, no tasks appear in Oracle BPEL Worklist Application.

  16. Return to Oracle BPEL Console.

  17. Click the Instances tab at the top.

  18. Click the OrderApproval instance.

    A message appears indicating that the instance has completed.

  19. Click the Audit and Flow links to observe additional details about the completed OrderApproval process.

11.2.2 Creating a Partner Link for the Order Approval Service


Summary:

You now create a partner link for the OrderApproval service.

  1. Ensure that you are in the OrderBooking process.

  2. Double-click OrderBooking.bpel.

  3. Ensure that Process Activities is selected in the drop-down list of the Component Palette section.

  4. Drag and drop a PartnerLink activity onto the right side of the designer window.

  5. Enter the following values to create a partner link for the OrderApproval service:


    Note:

    For the WSDL File field below, click the flashlight (the second icon from the left named WSIL Browser) to access the WSDL Chooser window for automatically selecting 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

  6. Click OK.

  7. Select Save from the File main menu.

11.2.3 Creating a Scope Activity


Summary:

You now create a Scope activity to group all activities that form a logical step to be executed.

  1. Drag and drop a Scope activity from the Component Palette section to below the SelectSupplier Switch activity.

  2. Double-click the scope icon to display the Scope window.

  3. Enter UserApproval in the Name field of the General tab.

  4. Click OK.

    In this phase of the tutorial, you create the Invoke, Receive, and Assign activities inside this Scope activity.

  5. Click the + sign to expand the Scope activity.

  6. Select Save from the File main menu.

11.2.4 Creating Invoke and Receive Activities

  1. Drag and drop an Invoke activity from the Component Palette section into the UserApproval Scope activity.

  2. Double-click the Invoke icon to display the Invoke window.

  3. Enter the following details:

    Field Value
    Name invokePOAService
    Partner Link POAService

    The Operation (initiate) field is automatically filled in.

  4. Click the first icon to the right of the Input Variable field. This is the automatic variable creation icon.

  5. 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.

  6. Click OK.

  7. Drag and drop a Receive activity to below the invokePOAService Invoke activity inside the UserApproval Scope activity.

  8. Double-click the Receive icon to display the Receive window.

  9. Enter the following details:

    Field Value
    Name receivePOAService
    Partner Link POAService

    The Operation (onResult) field is automatically filled in.

  10. Click the first icon to the right of the Variable field. This is the automatic variable creation icon.

  11. 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.

  12. Click OK.

  13. Select Save from the File main menu.

11.2.5 Creating an Initial Assign Activity

  1. Drag and drop an Assign activity from the Component Palette section to above the invokePOAService Invoke activity and inside the UserApproval Scope activity.

  2. Double-click the Assign icon to display the Assign window.

  3. Enter assignPOADataIn in the Name field of the General tab.

  4. Click Apply.

  5. Click the Copy Rules tab.

  6. Click Create to display the Create Copy Rule window.

  7. Enter the following details:

    Field Value
    From
    • Type
    Variable
    • Variables
    Expand and select Variables > inputVariable > payload
    To
    • Type
    Variable
    • Variables
    Expand and select Variables > invokePOAService_initiate_inputVariable > payload

  8. Click OK to close the Create Copy Rule window and the Assign window.

  9. Select Save from the File main menu.

11.2.6 Creating a Second Assign Activity

  1. Drag and drop an Assign activity from the Component Palette section to below the receivePOAService Receive activity and inside the UserApproval Scope activity.

  2. Double-click the Assign icon to display the Assign window.

  3. Enter UserResponse in the Name field of the General tab.

  4. Click Apply.

  5. Click the Copy Rules tab.

  6. Click Create to display the Create Copy Rule window.

  7. Enter the following details:

    Field Value
    From
    • Type
    Variable
    • Variables
    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
    • Type
    Variable
    • Variables
    Expand and select Variables > inputVariable > payload > ns1:PurchaseOrder > ns1:OrderInfo > ns1:OrderStatus

  8. Click OK.

  9. Click Create in the Copy Rules tab to again display the Create Copy Rule window.

  10. Enter the following details to create a second statement:


    Note:

    Instead of manually entering an expression, you can press Ctrl and then the space bar in the Expression field. Scroll through the list of values that appears and double-click the value you want. Edit the value as necessary. As you enter information, a trailing slash can appear. This means you are being prompted for additional information. Either enter additional information, or press the Esc key and delete the trailing slash to complete the input of information.

    Field Value
    From
    • Type
    Expression
    • Expression
    concat(bpws:getVariableData('inputVariable','payload','/ns1:PurchaseOrder/ns1:OrderInfo/ns1:OrderComments'), ', User Review Complete')
    To
    • Type
    Variable
    • Variables
    Expand and select Variables > inputVariable > payload > ns1:PurchaseOrder > ns1:OrderInfo > ns1:OrderComments

  11. Click OK to close the Create Copy Rule window and the Assign window.

    When complete, the designer window looks as follows:

    Description of obph10.gif follows
    Description of the illustration obph10.gif

  12. Click the - sign to close the UserApproval Scope activity.

  13. Select Save from the File main menu.

11.2.7 Validating, Compiling, and Deploying the Order Process

  1. Go to the Applications Navigator section.

  2. Right-click OrderBooking.

  3. Select Deploy > LocalBPELServer > Deploy to default domain.

  4. Enter the domain password of bpel when prompted.

  5. 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.

11.2.8 Running and Verifying the Order Process

  1. 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).

  2. Click the BPEL Processes tab.

  3. Note which OrderBooking version has an asterisk next to the version number. This is the default version.

  4. 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.

  5. Scroll down and click Mark as Default to make this the default version of OrderBooking.

  6. 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.

  7. 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.

  8. Click the Dashboard tab.

  9. 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.

  10. 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.


        Note:

        Do not copy and paste from Internet Explorer or Mozilla Firefox. You must use a text editor to perform this task.

      • Open the provided CreateOrderBookingUI application at http://localhost:9700/CreateOrderBookingUI and provide inputs to initiate a process.

  11. Verify that the OrderBooking process has started.

  12. 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.

  13. 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.

  14. 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
    
    
    Description of obph10bpm1.gif follows
    Description of the illustration obph10bpm1.gif

    The list shows the task awaiting user actions.

  15. Select Acquire in the Actions list and click Go to acquire a task.

  16. View the task details, the comments section, and so on.

    Description of obph10bpm2.gif follows
    Description of the illustration obph10bpm2.gif

  17. Approve or reject the task by selecting Accept or Reject from the Task Action list, and click Go.

  18. Log out of user jcooper. Rejects go directly back to the process, while approved tasks require the next level of approval.

  19. 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.

    Description of obph10bpm3.gif follows
    Description of the illustration obph10bpm3.gif

  20. View the task details, the comments section, and so on.

  21. 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.

  22. 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).

11.3 Summary

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: