![]() |
![]() |
|
|
Defining the ShipBill Workflow: An Exception Handling Example
The following sections explain the ShipBill workflow definition:
ShipBill Workflow Overview
The ShipBill workflow handles the shipping and billing of the ordered item.
In order to demonstrate the Exception Handling facility within WebLogic Process Integrator, the ShipBill workflow contains a user-defined exception handler. An error is purposefully introduced while invoking a business operation within the Billing task; this in turn invokes the user-defined exception handler. For more information on this topic, see Chapter 7, "Handling Workflow Exceptions," in BEA WebLogic Process Integrator Studio User Guide.
Import the ShipBill workflow template definition by using the procedure described in Importing the Start Order Processing Workflow Template Definition in Defining the Start Order Processing Workflow.
Once you import the workflow template definition for the ShipBill workflow, you do not have to perform the tasks discussed in this section for the purpose of this tutorial. However, for your reference, screen shots of dialog boxes that already contain the setup information are provided, as well as a brief overview explaining what was involved in defining the Ship/Bill workflow.
For details on procedures for creating and setting up a workflow, see Defining the Order Processing Workflow.
Opening the ShipBill workflow template displays the following flow.
Figure 4-1 Drawing Area: ShipBill Workflow Diagram
The ShipBill workflow is called by the Order Processing workflow, as defined in the C2 Decision node of the Order Processing workflow in Defining Decisions of Defining the Order Processing Workflow. ShipBill is a sub-workflow to Order Processing. The value of the following variables are transferred from the Order Processing workflow to the ShipBill workflow:
The Exception Handler
The ShipBill workflow contains a user-defined exception handler, which WebLogic Process Integrator invokes upon the passing of an incorrect parameter to the method called on POBean. This exception handler is set in the workflow through use of the Set Workflow Exception Handler action, located in the Activated tab of the Billing Task Properties dialog box. (See Billing Task.)
To view the properties of the exception handler, right click the EH Wrong data to POBean exception handler in the folder tree and select Properties.
Figure 4-2 Exception Handler Properties
Select the Actions from the Commit tab of the Exception Handler Properties dialog box to view the actions set in the commit path of the handler. Figure 4-3 Actions on Commit Tab
The Send XML to Client action prompts you at runtime with a message box to enter a valid state abbreviation, correcting the invalid state abbreviation: KK. Figure 4-4 Send XML to Client Dialog Box
After you enter a valid state abbreviation, the two actions defined in the Callback Actions of Send XML to Client will re-execute the task Billing and mark it as done. Figure 4-5 Send XML to Client: Callback Actions
The Exit Exception Handler action sets the exception handler exit to Continue. This stops the execution of the exception handler and attempts to continue the execution of the workflow at the next operation (in this case, the action following the business operation that caused the exception). Figure 4-6 Exit Exception Handler Dialog Box
Billing Task
The Billing task within the ShipBill workflow calls a method of the EJB POBean, which calculates the final price of the ordered item including tax and returns the value to the variable: TotalPrice.
The Activated tab of the Billing Task Properties dialog box contains three actions:
Figure 4-7 Billing Task Properties Dialog Box: Activated Tab
The Assign Task to User action is set in the Activated tab. This action assigns the Billing task to the user joe. Double-click this action in the Activated tab to display the Assign Task to User dialog box.
Figure 4-8 Assign Task to User Dialog Box
The ShipBill workflow contains a user-defined exception handler, which is invoked upon the passing of an incorrect parameter to the POBean. This exception handler is set in the workflow through use of the Set Workflow Exception Handler action, located in the Activated tab of the Billing Task Properties dialog box. Double-click the Set exception handler to "EH Wrong data to POBean" task to display the Set Workflow Exception Handler dialog box. Figure 4-9 Set Exception Workflow Handler Dialog Box
A Set Workflow Variable action is set in the Activated tab of the Billing Task Properties dialog box. This action purposefully, for demonstration, sets the value of the variable CustomerState to the invalid state abbreviation (KK). Invoking the Perform Business Operation action, which uses this value as an input, introduces an exception, which invokes the exception handler. Figure 4-10 Set Workflow Variable Dialog Box
The Executed tab of the Billing Task Properties dialog box contains two Perform Business Operation actions. Figure 4-11 Billing Task Properties Dialog Box: Executed Tab
The first Perform Business Operation action creates a handler for the EJB POBean in order to allow for calling methods of this bean. Figure 4-12 Perform Business Operation CreatePOBean
The second Perform Business Operation action calls the method that calculates the total price and returns the result to the variable TotalPrice. Figure 4-13 Perform Business Operation Calculate Total Price
Send Confirmation Back Task
WebLogic Process Integrator sends the TotalPrice variable to the Order Processing workflow by way of an XML message that is created and sent upon execution of the Send Confirmation Back task.
Note the use of the AND join in this workflow, whereby both tasks, Shipping and Billing, have to be marked as done before the flow moves on.
In the workflow diagram, double-click the Send Confirmation Back task to display the task properties.
Figure 4-14 Task Properties Dialog Box: Activated Tab
The Send Confirmation Back task is assigned to the role: Role1 by use of the Assign Task to Role action, as illustrated in the following dialog box. Figure 4-15 Assign Task to Role Dialog Box
Select the Executed tab of the task. Figure 4-16 Task Properties Dialog Box: Executed Tab
Upon execution of this task, an internal XML message is posted to the WebLogic Process Integrator server that will trigger the event in the Order Processing workflow and complete the entire process. Click Update on the Post Internal XML Event action. Note: The exception handler is reset to the System exception handler to avoid calls to the customized exception handler within this workflow; the System exception handler responds to any errors that may occur other than the one purposefully introduced in this workflow. Figure 4-17 Post XML Event Action Dialog Box: Internal XML Event
![]() |
![]() |
![]() |
|
Copyright © 2000 BEA Systems, Inc. All rights reserved.
|