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 invoke an asynchronous service.
This chapter contains the following topics:
This phase of the tutorial adds to the OrderBooking process you created in Chapter 2, "Invoking a Synchronous Service". Ensure that you have successfully completed that phase before performing this one. In this phase, you build a simple asynchronous BPEL process. You perform the following key tasks:
Deploy an asynchronous Rapid Distributors service.
Create a partner link to interact with the Rapid Distributors service.
Design the BPEL process to invoke the Rapid Distributors service.
Deploy the BPEL process.
Run the deployed BPEL process from Oracle BPEL Console by completing and submitting an order form to the Rapid Distributors service.
Review the supplier price returned from the Rapid Distributors service to the client.
This section contains the following tasks:
During this tutorial, the BPEL process that you design communicates with the Rapid Distributors and Select Manufacturing services. You must first start these services and test that they are running.
Select Start > All Programs > Oracle - Oracle_Home > Oracle BPEL Process Manager 10.1.2 > Developer Prompt to open up an operating system command prompt at the Oracle_Home
\integration\orabpel\samples
directory.
Change directories to the tutorials\127.OrderBookingTutorial\PriceQuote
subdirectory.
cd tutorials\127.OrderBookingTutorial\PriceQuote
Enter the following command:
obant
This deploys and starts the Rapid Distributors service required for using this phase of the tutorial. If successful, a message appears at the end:
BUILD SUCCESSFUL
The Select Manufacturing service and user application are also created. You use these services later in Chapter 4, "Adding Parallel Flow".
Access Oracle BPEL Console to see if all required services are running by selecting Start > All Programs > Oracle - Oracle_Home > Oracle BPEL Process Manager 10.1.2 > BPEL Console.
Click Login with default selected from the Domain list. The password is bpel.
The services for this phase are running if RapidDistributors and SelectManufacturing display in the Dashboard tab.
Summary: You now create the partner link for the Rapid Distributors service. |
Return to JDeveloper BPEL Designer.
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 Rapid Distributors 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 Rapid Distributors service deployed in "Starting and Testing Your Services". |
Field | Value |
---|---|
Name | RapidDistributors |
WSDL File | Access this URL by clicking the WSIL Browser flashlight icon and expanding and selecting LocalBPELServer > processes > default > RapidDistributors.
http://localhost:9700/orabpel/default/RapidDistributors/RapidDistributors?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 | RapidDistributors |
My Role | RapidDistributorsRequester |
Partner Role | RapidDistributorsProvider |
Click OK.
Select Save from the File main menu.
Drag and drop an Invoke activity from the Component Palette section to below the GetCreditRating Scope activity.
Double-click the Invoke icon to display the Invoke window.
Enter the following details:
Field | Value |
---|---|
Name | invokeRD |
Partner Link | RapidDistributors |
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 invokeRD_initiate_InputVariable is automatically created in the Input Variable field. This variable is automatically assigned a message type of RapidDistributorsRequestMessage.
Click OK.
Drag and drop a Receive activity below the invokeRD Invoke activity you just created.
Double-click the Receive icon to display the Receive window.
Enter the following details:
Field | Value |
---|---|
Name | receiveRD |
Partner Link | RapidDistributors |
The Operation (onResult) field is automatically filled in.
Click OK on the Create Variable window that appears.
A variable named receiveRD_onResult_InputVariable is automatically created in the Variable field. This variable is automatically assigned a message type of RapidDistributorsResponseMessage.
Click OK.
Select Save from the File main menu.
Drag and drop an Assign activity from the Component Palette section to above the invokeRD Invoke activity you just created.
Double-click the assign icon to display the Assign window.
Click the General tab.
Enter assignRDIn 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 > ns1:OrderItems
Note: The namespace number values (for example, ns1, ns2) can vary. Use the namespace values that automatically appear. |
To |
|
|
Variable |
|
Expand and select Variables > invokeRD_initiate_InputVariable > payload > ns1:OrderItems |
Click OK to close the Create Copy Rule window and the Assign window.
Select Save from the File main menu. In this phase of the tutorial, you do not create an additional Assign activity to explicitly copy the received data of invokeRD_initiate_InputVariable into another variable.
When complete, the designer window looks as follows:
Go to the Applications Navigator section.
Right-click OrderBooking.
Enter the domain password of bpel when prompted.
The Deploy Properties window appears.
Increment the version number of the project (for example, enter 1.1) and click OK. When you access Oracle BPEL Console, a new version of the OrderBooking process appears, along with the phase 1 OrderBooking process version you created in "Validating, Compiling, and Deploying the Order Booking Process".
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).
The Dashboard tab of Oracle BPEL Console appears. Note that two versions of the OrderBooking process appear: 1.0 and 1.1. Version 1.0 is the default version, so an asterisk appears to the right.
Click the OrderBooking version you increased in Step 5 (for this example, (v. 1.1)) 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 you copied into the OrderBooking
directory in Step 1:
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
Verify that the OrderBooking, CreditRatingService, 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 and Flow links to follow the instance execution process.
Click More to the right of receiveRD under the Audit link for the OrderBooking instance to see the returned supplier price (returned in the variable receiveRD_onResult_InputVariable).
Verify other process states and variable values at different stages.
Note: Throughout this tutorial, RapidDistributors always quotes a price of 5000. |
You have now built a simple asynchronous BPEL process that received a supplier price for an order from a service. You performed the following key tasks:
Deployed an asynchronous Rapid Distributors service.
Created a partner link to interact with the Rapid Distributors service.
Designed the BPEL process to invoke the Rapid Distributors service.
Deployed the BPEL process.
Ran the deployed BPEL process from Oracle BPEL Console by completing and submitting an order form to the Rapid Distributors service. Since the Rapid Distributors service was an asynchronous service, an extended time interval between the external service request and response is possible.
Reviewed the supplier price returned from the Rapid Distributors supplier service to the client.