Oracle® BPEL Process Manager Order Booking Tutorial 10g (10.1.3.1.0) Part Number B28987-01 |
|
|
View PDF |
This chapter of the tutorial describes how to build conditional branching logic.
This chapter contains the following topics:
This phase of the tutorial adds to the OrderBooking process you designed in Chapter 4, "Adding Parallel Flow". Ensure that you have successfully completed that phase before performing this one. In this phase of the tutorial, you build conditional branching logic to select the lowest priced supplier. You perform the following key tasks:
Design conditional branching logic to select the lower price from the two services (Rapid Distributors and Select Manufacturing).
Deploy the BPEL process.
Run the deployed BPEL process from Oracle BPEL Control by completing and submitting an order form that is sent in parallel to the Rapid Distributors service and the Select Manufacturing service.
Access the Rapid Distributors URL to manually submit a supplier price.
Review the lower of the two supplier prices returned from the Rapid Distributors service and the Select Manufacturing service.
This section contains the following tasks:
Creating an Assign Activity Under the Case Block for the Rapid Distributors Service
Creating an Assign Activity Under the Otherwise Block for Select Manufacturing
Validating, Compiling, and Deploying the Order Booking Process
Summary:
To compare the two offers and make decisions based on that comparison, the BPEL flow requires a Switch activity. A Switch activity includes two branches: <case> and <otherwise>. The first branch is executed if a defined condition (inside the <case> branch) is met. If it is not met, the <otherwise> branch is executed.Select Process Activities from the Component Palette section.
Drag and drop a Switch activity from the Component Palette section to below the GetPriceQuote Flow activity.
Double-click the question mark for the Switch activity to display the Switch window.
Enter SelectSupplier in the Name field.
Click OK.
Click the + sign to expand the Switch activity.
Double-click <case> to display the Switch Case window.
Enter the following expression in the Name field:
'Is the Rapid Distributors price less than the Select Manufacturing price?'
Press Ctrl and then the space bar in the Expression field to display a list for selecting (double-clicking) the following syntax. Edit 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.
bpws:getVariableData('receiveRD_onResult _InputVariable','payload','/ns1:SupplierInfo/ns1:SupplierPrice') < bpws:getVariableData('receiveSM_onResult 095;InputVariable','payload','/ns1:SupplierInfo/ns1:SupplierPrice')
Click OK.
Select Save from the File main menu.
Summary:
This Assign activity assigns the Rapid Distributors supplier to the supplier part of the input purchase order variable.Drag and drop an Assign activity from the Component Palette section under the <case> section of the SelectSupplier Switch activity.
Double-click the Assign activity.
Click the General tab.
Enter SelectRapidDistributors in the Name field.
Click Apply.
Click the Copy Operation tab.
Click Create and select Copy Operation to display the Create Copy Operation window.
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 | |
|
Expression |
|
concat(bpws:getVariableData('inputVariable','payload','/ns1:PurchaseOrder/ns1:OrderInfo/ns1:OrderComments'), ' - Selected: Rapid Distributors')
Note: Press Ctrl and then the space bar to display a list for selecting (double-clicking) this syntax. The namespace number values (for example, ns1, ns2) can vary. Use the namespace values that automatically appear. Remove any trailing forward slashes (/) that appear at the end. |
To | |
|
Variable |
|
Expand and select Variables > inputVariable > payload > ns1:PurchaseOrder > ns1:OrderInfo > ns1:OrderComments |
Click OK to close the Create Copy Operation window.
Click the Copy Operation tab.
Click Create and select Copy Operation to display the Create Copy Operation window.
Enter the following details to create a second statement:
Field | Value |
---|---|
From | |
|
Variable |
|
Expand and select Variables > receiveRD_onResult_InputVariable > payload > ns1:SupplierInfo
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:SupplierInfo |
Click OK to close the Create Copy Operation window and the Assign window.
Select Save from the File main menu.
Summary:
This Assign activity assigns the Select Manufacturing supplier to the supplier part of the input purchase order variable.Drag and drop an Assign activity from the Component Palette section under the <otherwise> section of the SelectSupplier Switch activity.
Double-click the Assign activity.
Click the General tab.
Enter SelectManufacturing in the Name field.
Click Apply.
Click the Copy Operation tab.
Click Create and select Copy Operation to display the Create Copy Operation window.
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 | |
|
Expression |
|
concat(bpws:getVariableData('inputVariable','payload','/ns1:PurchaseOrder/ns1:OrderInfo/ns1:OrderComments'), ' - Selected: SelectManufacturing')
Note: Press Ctrl and then the space bar to display a list for selecting (double-clicking) this syntax. The namespace number values (for example, ns1, ns2) can vary. Use the namespace values that automatically appear. Remove any trailing forward slashes (/) that appear at the end. |
To | |
|
Variable |
|
Expand and select Variables > inputVariable > payload > ns1:PurchaseOrder > ns1:OrderInfo > ns1:OrderComments |
Click OK to close the Create Copy Operation window.
Click the Copy Operation tab.
Click Create and select Copy Operation to display the Create Copy Operation window.
Enter the following details to create a second statement:
Field | Value |
---|---|
From | |
|
Variable |
|
Expand and select Variables > receiveSM_onResult_InputVariable > payload > ns1:SupplierInfo
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:SupplierInfo |
Click OK to close the Create Copy Operation window and the Assign window.
When complete, the designer window looks as follows:
Click the - sign to close the Switch activity.
Select Save from the File main menu.
Go to the Application Navigator section.
Right-click OrderBooking.
Select Deploy > my_integration_server_connection > Deploy to default domain.
Increment the version number of the project when prompted and click OK (for example, enter 1.3).
This compiles the BPEL process. Check for errors by clicking the buttons at the bottom of the window. If there are no errors, deployment was successful. If deployment was unsuccessful, see Step 4.
Access Oracle BPEL Control by selecting Start > All Programs > Oracle - Oracle_Home > Oracle BPEL Process Manager > BPEL Control (or refresh the page if it is already open).
Enter the following details to log into Oracle BPEL Control and click Login:
Field | Value |
---|---|
Username | oc4jadmin |
Password | password |
Where password
is the value you entered during installation.
The Dashboard tab of Oracle BPEL Control appears.
Start the OrderBooking instance version you increased in Step 4 in one of the following ways:
Click OrderBooking in the Deployed BPEL Processes list and enter details in all fields of the HTML Form and click Post XML Message.
Click OrderBooking in the Deployed BPEL Processes list and click the XML Source radio button. 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.
The BPEL Processes tab displays a message similar to the following:
Test Instance Initiated
Complete the manual price quote task for SelectManufacturing by using the graphical user interface JSP page, as described in Step 11.
Return to Oracle BPEL Control.
Click the Instances tab at the top.
Verify that the OrderBooking, CreditRatingService, SelectManufacturing, and RapidDistributors instances were created. All should appear in the Instance list. The Last Modified list displays the times at which they were created.
Click the instances.
Click the Audit link to follow the instance execution process.
Click the More... link for each sequence to view the activity details.
Verify the results of conditional branching, the value of the price quote, and the execution path of the condition logic. (Similar instance management can also be obtained in a graphical fashion under the Flow link.)
You have now built conditional branching logic to select the lowest priced supplier. You performed the following key tasks:
Designed conditional branching logic to select the lower price from the two services (Rapid Distributors and Select Manufacturing).
Deployed the BPEL process.
Ran the deployed BPEL process from Oracle BPEL Control by completing and submitting an order form that was sent in parallel to the Rapid Distributors service and the Select Manufacturing service.
Accessed the Rapid Distributors URL to manually submit a supplier price.
Reviewed the lower of the two supplier prices returned from the Rapid Distributors service and the Select Manufacturing service. After the two supplier services (Rapid Distributors and Select Manufacturing) returned with a price quote, a conditional branching decision was taken to select the lowest priced supplier.