bea.com | products | dev2dev | support | askBEA

Download Docs | Site Map | Glossary
Search

Learning to Use BPM

Executing and Monitoring the Example Workflows

Note: The Worklist client application is being deprecated as of this release of WebLogic Integration. For information about the features that are replacing it, see the BEA WebLogic Integration Release Notes.

In this section we execute the example workflows from the WebLogic Integration Worklist. We then monitor the running instances of the workflows from the Studio.

Before you can do the procedures given in this section, it is assumed that you have done the following:

- Logged on to the Studio, as described in Starting the WebLogic Integration Studio.

- Imported and activated the Order Processing Trigger and Order Fulfillment template definitions and their dependencies, as described in Importing Workflow Objects: Importing the Tutorial Package File.

- Either imported the Order Processing template definition and its dependencies, as described in Importing Workflow Objects: Importing the Tutorial Package File, or created and defined it from scratch, as described in Creating a Workflow, and Defining Workflow Nodes.

Note: Although the Worklist and the monitoring functions of the Studio are described in this section, the section is not intended to serve as a tutorial for them. For more information about these topics, see Using the WebLogic Integration Worklist and Monitoring Workflows in Using the WebLogic Integration Studio.

Executing the Workflows in the Worklist Application

Because the Order Processing Trigger workflow contains a manual start, we can execute it from the Worklist application. This workflow then launches all the tasks of the Order Processing and Order Fulfillment workflow. In this section, we do the following:

- Log on to the Worklist

- Start the Order Processing Trigger workflow

- Execute the tasks in the Order Processing workflow

- Execute the tasks in the Order Fulfillment workflow

Logging On to the Worklist Application

Because we have defined the user admin as a member of all the roles used in the sample workflows, we will log on as admin.

To start the WebLogic Integration Worklist:

1. Do one of the following:

   - On a Windows system, choose Start—>Programs—>BEA WebLogic Platform 7.0—>WebLogic Integration 7.0—>Worklist.

   - On a UNIX system, go to the WLI_HOME/bin directory, and run the Worklist start-up script by entering the following at the command prompt:

   sh worklist.sh

   The Logon to WebLogic Integration dialog box appears in front of the WebLogic Integration Worklist application window.

   Figure 7-1 Logon to WebLogic Integration Dialog Box

2. In the User Name field, enter admin.

3. In the Password field, enter security.

   Note: User names and passwords are case-sensitive. Be sure to enter user names and passwords in lower case.

4. In the Server [:port] field, specify the system that is running the WebLogic Integration server application as follows:

   >     t3://host:7001

   Here host is the computer name or IP address of the system that is running the WebLogic Integration server. Specify localhost if the server is running on the same computer as the Worklist application.

5. Click OK. The WebLogic Integration Worklist dialog box appears.

   Figure 7-2 WebLogic Integration Worklist Dialog Box

6. Click OK. The Worklist main window appears.

   Figure 7-3 Worklist Application Main Window

7. From the drop-down list at the top of the window, select CDExpress. The roles associated with the user for that organization appear as tabs next to the user name tab. In this case, the roles are Accounting, CustomerService, and Shipping.

8. From the View menu, select the Done check box. This allows you to view both Pending and Done tasks in the worklist window.

Starting the Sample Workflows

We start the sample workflows by starting the Order Processing Trigger workflow, which was designed to be started manually. It sets off the main workflow of the sample, Order Processing.

Any Worklist user can start the workflow.

To start the Order Processing Trigger workflow:

1. Choose Workflow—>Start a Workflow. The Start Workflow dialog box is displayed.

   Figure 7-4 Start Workflow Dialog Box

2. In the Select the organization drop-down list, select CDExpress.

3. From the Select a workflow to start window, select Order Processing Trigger and click OK. An instance of the workflow is created, and a message confirming the successful start of the workflow appears.

   Because the first task in this workflow is assigned to the initiator of the workflow (for more information, see Understanding Task Node Properties: Viewing the Start Order Processing Task Node), the following message also appears.

4. Click OK to close both message boxes. The Start Order Processing task appears in the worklist under the same user name.

   Figure 7-5 Worklist Application: Task List

5. To execute the task, double-click it in the task list. The execution of the task creates the XML document that triggers the Order Processing workflow, and the first task is assigned to admin.

Notice that the status of the Start Order Processing task does not change to Done. This is because this task is assigned interminably, as specified by the looping mechanism and the lack of a Done node in the workflow design (see Understanding Task Node Properties: Viewing the Start Order Processing Task Node).

Each time you execute this task, another instance of it appears in admin's tasklist. Thus, every time you want to start the Order Processing workflow, you do not need to start the Order Processing Trigger workflow from the Workflow menu; you simply double-click the Start Order Processing task in the worklist.

Executing the Order Processing Workflow Tasks

The first task in the Order Processing workflow is the credit check, which was assigned to the user admin. In this section, we will execute all the tasks specified in the workflow path that follows a Yes response to the Check Customer Credit task.

To execute the Order Processing workflow tasks:

1. In the message box that informs you of the new task, click OK.

2. Under the admin user tab, double-click the Check Customer Credit task to execute it. The Credit Check message box appears. (We set up this message box in Defining the XML Document Structure.)

   Figure 7-6 Credit Check Message Box

3. In the message box, click Yes for now. This marks the task done, as indicated by the checkmark in the Status column.

   Figure 7-7 Task Marked Done

At this point, let us view the status of the Order Processing workflow to which the Check Customer Credit task belongs. Select the Check Customer Credit task, and choose Workflow—>Workflow Status. The Workflow Status dialog box appears.

Figure 7-8 Workflow Status Dialog Box

Note that the Check Inventory task, an automated task, is already marked done. When the inventory check passes (which it always does in our example), the next task is the Start Order Fulfillment task, which automatically starts the Order Fulfillment sub-workflow.

Executing the Order Fulfillment Workflow Tasks

The workflow assigns the Generate Invoice task to the Accounting role and the Ship Order task to the Shipping role at the same time. If you switch between the Accounting and Shipping role tabs, you see that the tasks appear simultaneously. Although the order in which we execute either of these tasks is unimportant, we will start with the shipping task.

Note also that if you logged on to the Worklist as joe, who is defined as a member of the Accounting role, the Generate Invoice task is also included in joe's worklist on the Accounting role tab. If you logged on to the Worklist as mary, who is defined as a member of the Shipping role, the Ship Order task is also included in mary's worklist on the Shipping role tab. If you want to try executing the tasks from those worklists, open additional instances of the Worklist by logging on with those user names. Enter password as the password for both users.

To execute the Order Fulfillment workflow tasks:

1. Select the Shipping tab. Notice that the Ship Order task contains a comment with instructions for shipping. This comment was specified in the workflow template definition.

2. Double-click the Ship Order task to execute it.

3. Select the Accounting tab.

4. Double-click the Generate Invoice task to execute it.

   As you may recall from Defining a Custom Exception Handler: Viewing the Bad Data to OrderBean Exception Handler, executing this task causes the Calculate Total Price business operation to be performed. This operation, in turn, causes the invalid KK state data provided in the Order Processing Trigger workflow XML event to be passed to the calculate() method on the POBean EJB. The calculate() method then causes the server to throw the BadStateException exception.

   Because the Order Fulfillment workflow defines an exception handler to catch the exception, you do not see any evidence of the exception in the Worklist client. Instead, you simply receive the message box specified by the Send XML to Client action defined in the Bad Data to OrderBean exception handler. (For more information, see Viewing the Send XML to Client Action.)

   Figure 7-9 Error Warning Dialog Box

   Let us see what happens if we again enter invalid state data.

5. In the message box field, enter invalid data, such as XYZ. Notice that you are reprompted with the same message.

6. Now enter a valid two-letter state abbreviation, such as CA.

The Generate Invoice task is now executed and marked as done. The Calculate Total Price business operation calculates the total price of the order, and returns the value to the Order Processing workflow. The Confirm Order Fulfillment task is automatically executed and the entire process is complete.

If you included the Send E-mail action when defining the Order Processing workflow (see Sending an E-mail Message: Defining the Confirm Order Fulfillment Task), you will receive the e-mail with the text you composed.

Otherwise, you can view the results of the complete workflow operation by following the procedures in the next section.

Monitoring the Running Workflows in the Studio

In this section we will rerun the workflows twice, following the two paths specified in the Order Processing workflow: the first time we will reply No to the Check Customer Credit task and execute the Contact Customer task, which terminates the Order Processing workflow; the second time we will reply Yes and execute the remaining tasks of both the Order Processing and Order Fulfillment workflows.

At the same time that we run the workflows in the Worklist, we monitor the running workflow instances in the Studio. You should have both the Worklist and an instance of the Studio open, in the organization CDExpress.

To run and monitor the Order Processing workflow instances:

1. In the Worklist, select the admin tab, and double-click the Start Order Processing task. The Order Processing workflow is triggered.

2. In the Studio, right-click the Order Processing template in the folder tree, and from the pop-up menu, select Instances. The Workflow Instances dialog box appears.

   Note that two instances are displayed: the first is the workflow we executed in the previous section; the second, the instance we have just begun. Note that the Order ID has incremented; now it is 2.

   Figure 7-10 Workflow Instances Order Processing Dialog Box

3. Double-click Order 2 in the list of instances. The Workflow Status window appears.

   Figure 7-11 Workflow Status Order Processing Window

4. Click the Vars button to view the current setting of variables in the workflow. The Workflow Variables window appears.

   Figure 7-12 Workflow Variables Window

5. Click Close to close the Workflow Variables window.

6. Close the Workflow Status window.

7. Switch back to the Worklist.

8. On the admin user tab, double-click the Check Customer Credit task to execute it.

9. When the message box appears, click No. Now the flow proceeds to the Contact Customer task, which was assigned to the role CustomerService (to which admin belongs).

10. Click the CustomerService tab. In the Comment column is the expression we defined in Adding a Task and Workflow Comment: Defining the Contact Customer Task. The comment provides instructions that the user should follow before executing the task.

    Figure 7-13 Task Comment

11. Double-click the task to execute it. Now the flow terminates. Let us return to the Studio to see the results displayed in the workflow instances.

12. In the Workflow Instances dialog box in the Studio, click Refresh. The workflow now appears complete; it includes the workflow comment Order cancelled that you defined in Setting the Workflow Comment.

13. Double-click the Order 2 instance to display the Workflow Status window. Now the Contact Customer task appears in grey.

14. Click Vars to display the Workflow Variables dialog box.

15. Click Close to close the Workflow Variables window.

16. Close the Workflow Status window.

Now we will rerun the workflow for a third time to monitor the instance of the completed workflow after a Yes response to the credit check task.

To rerun and monitor the Order Processing and Order Fulfillment workflows:

1. In the Worklist, select the admin user tab, and double-click the Start Order Processing task. The Order Processing workflow is triggered. It now appears with the label Order 3.

2. Select the admin tab, and double-click the Check Customer Credit task to execute it. The Credit Check message box appears again.

3. This time, click Yes. The workflow proceeds to the Check Inventory task.

4. Now switch back to the Studio.

5. In the Workflow Instances dialog box, click Refresh. The new instance appears, this time identified as Order 3.

6. Double-click the Order 3 instance to display the Workflow Status window, which now appears with the Check Customer Credit and Check Inventory tasks in gray.

7. Now click Vars to display the Workflow Variables window.

8. Click Close to close the Workflow Variables window.

   Because the value in the Inventory variable (536) is greater than the value in the ItemQuantity variable (2), the Order Fulfillment workflow is now launched and you can monitor its instances.

9. In the folder tree, right-click the Order Fulfillment template, and select Instances from the pop-up menu. The Workflow Instances Order Fulfillment dialog box appears, with two instances of the workflow displayed.

   Figure 7-14 Workflow Instances Order Fulfillment Dialog Box

10. Double-click Order 3. The Workflow Status window appears.

11. This time, click the List Instances button to see the status in list view.

    Figure 7-15 Workflow Status Order Fulfillment Window

12. Click Vars to display the Workflow Variables window.

13. Click Close to close the Workflow Variables window.

14. Return to the Worklist window.

15. Select the Shipping role tab, and double-click the Ship Order task to execute it.

16. Select the Accounting tab, and double-click the Generate Invoice task. In the Error Warning message box, enter a valid state abbreviation, such as CA.

17. Return to the Studio.

18. In the Workflow Status Order Fulfillment window, click the Instance Refresh button .

19. Now click Vars to display the Workflow Variables window.

20. Click Close to close the window.

21. Close the Workflow Status Order Fulfillment window.

22. In the Workflow Instances Order Processing dialog box, click Refresh. The window shows that the workflow is complete.

23. Double-click Order 3 to see the Workflow Status window. The window shows that the workflow is complete.

24. Click Vars to view the variables for the completed workflow.

25. Close the Workflow Variables window, and close the Workflow Status window.

26. Close any other open windows.

You have now completed the business process management tutorial.