Skip Headers
Oracle® SOA Suite Quick Start Guide
10g (10.1.3.1.0)

Part Number B28938-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

4 Adding BPEL and ESB Design Elements with Oracle JDeveloper

In Chapter 3, you placed orders and watched them process through the SOA Order Booking business flow. In this chapter, you will learn how to use the JDeveloper BPEL and ESB Designers to add BPEL and ESB elements.

This chapter includes the following sections:

4.1 Introduction to the JDeveloper BPEL Designer

This section provides a brief introduction to the JDeveloper BPEL designer. In the next section, Section 4.2, "Adding a Credit Rating Service to the SOAOrderBooking Process", you will make modifications to the SOAOrderBooking BPEL process.

To familiarize yourself with the JDeveloper BPEL designer:

  1. In the Applications Navigator of JDeveloper, expand SOADEMO > SOAOrderBooking > Integration Content.

  2. Double-click SOAOrderBooking.bpel.

    The process displays in the JDeveloper BPEL Designer.

  3. Right-click the Start icon at the top of the scope and select Collapse All Children.

    Description of collapse.gif follows
    Description of the illustration collapse.gif

    The main logic of this BPEL process collapses into a scope called main. The other activities to the right under client:OrderBookingFault is the main exception handler for the process and can be ignored for now.

    The yellow swim lanes on the left and right-hand sides of the main window are where the services resides. These are the services that are invoked at various stages of the BPEL process. The white area in the middle is where the BPEL logic resides.

  4. Expand the main scope by clicking the Expand icon (+).

    Description of main.gif follows
    Description of the illustration main.gif

    The first round blue icon named receiveInput represents when something invokes this BPEL process. The input to this process is passed to this receive activity.

  5. Scroll all the way to the bottom of the main scope to see a square blue invoke activity called callbackClient.

    Description of callback.gif follows
    Description of the illustration callback.gif

    This activity represents the end of the BPEL process and returning the result data to the client that invoked this process. (BPEL processes do not have to return data. BPEL processes can simply end.)

    Everything between receiveInput and callbackClient contains the logic of the BPEL process.

    The BPEL language has several container activities, that is, activities that can contain other activities. The most commonly used is the scope activity. A scope activity does not actually execute or do anything, it simply holds other activities, including other scopes. Scopes are analogous to curly braces in Java. You can use them to break up your process into logical chunks.

  6. Expand the CustomerService scope, located toward the beginning of the process, by clicking the Expand icon (+).

    Sequence_9 appears. Many scopes contain an inner sequence. If you come across one, simply expand it to see the activities it contains.

  7. Expand the Sequence_9 sequence by clicking the Expand icon (+).

    When this BPEL process was invoked, part of the input to the process is the customer ID of the customer submitting the order. The business process takes that ID and retrieves the customer's details, such as address and credit card number. You can see this process with the GetCustInfo invoke activity. An invoke activity invokes a service. If you follow the blue line coming out of GetCustInfo, you will see that it invokes CustomerService.

    Description of getcustinfo.gif follows
    Description of the illustration getcustinfo.gif

    In this case, CustomerService is being invoked synchronously, so the BPEL process will wait until the service returns the results before continuing.

    Before and after the GetCustInfo invoke activity, there are assign activities. An assign activity assigns data to variables. In this case, the customer ID is assigned to the variable that is sent as input to CustomerService, and another assign activity copies the return data from that service to a variable that can be used and referred to later in the BPEL process.

    All of the activities in this scope are loosely involved in retrieving the customer information, which is why they are grouped together in a scope. Scopes break up the process into logical chunks to simplify development and make the process easier to read and work with.

  8. Click the Collapse icon (-) icon on the CustomerService scope to collapse it.

    Description of customerservicecoll.gif follows
    Description of the illustration customerservicecoll.gif

  9. Scroll down to the requiresApproval switch activity and click the Expand icon (+).

    Description of requiresapprov.gif follows
    Description of the illustration requiresapprov.gif

  10. Click the Expand icon (+) on the case statement.

    The sequence appears.

    Description of requiresapprov2.gif follows
    Description of the illustration requiresapprov2.gif

  11. Click the Expand icon (+) on the sequence.

    Description of requiresapprov3.gif follows
    Description of the illustration requiresapprov3.gif

    The green ApproveOrder activity represents invoking a human workflow activity as part of this BPEL process.

  12. Double-click ApproveOrder.

    The Human Task dialog appears.

    Description of humantask.gif follows
    Description of the illustration humantask.gif

  13. Click the Edit Task Definition icon. It is the third icon to the right of the Task Definition field that looks like a pencil.

    The ApproveOrder.task page displays. This screen enables you to define the behavior of your human workflow.

    Description of humantask2.gif follows
    Description of the illustration humantask2.gif

    In this case, the Outcomes field shows that a request can be approved or rejected. You can define routing policies in the Assignment and Routing Policy section. In this case, a task is submitted to the Supervisor group for approval. For you process, you can specify a complex series of routing rules. For example, a workflow could specify to get approval from Sales, then from the Sales Manager, and then obtain final approval from a person named Fred.

    There are several other settings that can be specified, such as how long until the task expires, how to notify participants in the workflow, escalation rules, and so on.

  14. Close the ApproveOrder.task page by hovering your mouse over the tab and pressing X.

    Description of humantask3.gif follows
    Description of the illustration humantask3.gif

  15. Back in the Human Task dialog, click Cancel.

  16. Click the Expand icon (+) on the taskSwitch switch activity.

    Description of taskswitch.gif follows
    Description of the illustration taskswitch.gif

    A switch activity is like an if-then-else or case or switch statement in other languages.

    Notice that the taskSwitch activity has cases for handling if the human workflow task is rejected, approved, or something else, such as expired.

  17. Click the View Condition Expression icon for the REJECT case to see the XPath evaluation expression, and then press the Escape key when done viewing.

    Description of taskswitch2.gif follows
    Description of the illustration taskswitch2.gif

  18. Click the Expand icon (+) on the same REJECT case, and then the inner sequence.

    It shows the activities that execute if the workflow task is rejected. In this case, data is assigned to some variable and an exception is thrown.

  19. Scroll all the way to the top of the BPEL process, right-click the Start icon at the top of the scope, and select Collapse All Children.

4.2 Adding a Credit Rating Service to the SOAOrderBooking Process

One of the strengths of BPEL is that it is an implementation-independent language for describing a business process. Because the logic of your business process is separate from the code, it is easy to re-orchestrate your BPEL flows when your business process changes.

For example, after deploying the existing BPEL process, you discover that Global Company has been selling its products to customers with a bad credit rating, resulting in a loss of money from these types. You can adjust the business process to check the credit rating of the buyer before selling the product.

The SOAOrderBooking BPEL process already does a credit check on the customer by checking their credit card. You can see this by following these steps:

  1. Click the Expand icon (+) on the main scope.

  2. Scroll down to the CreditService scope and click the Expand icon (+).

  3. Expand the inner sequence, called Sequence_5.

    Description of creditservice.gif follows
    Description of the illustration creditservice.gif

    Notice there is an invoke activity called InvokeCreditService, which invokes the service called CreditValidatingService. In this case, the process is sending the credit card information to the Credit Validation service, and the service responds by determining if the credit card is valid or not.

  4. Click the Collapse icon (-) icon on the CreditService scope to collapse it

In addition to checking if the customer's credit card is valid, you can modify the process to check the credit rating of customers. A Web service called CreditRatingService exists that the process can utilize. The Web service takes a Social Security number as its input, and returns the credit rating for that Social Security number.

The BPEL process needs to retrieve the Social Security number for the customer. Early in the BPEL process, CustomerService is called to retrieve several details about the customer, but Social Security number is not included. The Social Security number information is stored in a different database. In typical deployments, it is common for companies to store data in multiple places. Using BPEL, you can easily retrieve that different data and pull it together for your business processes.

In this scenario, you will modify the existing BPEL process to retrieve the Social Security number for customer sking from a different database. The BPEL process will then pass that Social Security number to the CreditRatingService service to get the customer's credit rating. You will perform the following tasks:

4.2.1 Task 1: Create a Database Connection for the Database Containing the Social Security Number

To access the Social Security number information, create a database connection to the database containing it. In this case, you will create another connection to the SOADEMO schema, which connection soademo is already using. In a real-world deployment, this connection would point to a different database. However, using a different table in the same database in adequate for this demonstration.

To create a database connection:

  1. Start JDeveloper by running JDEV_HOME\jdeveloper.exe.

  2. Create a connection to the database using the SOADEMO schema:

    1. Click the Connections tab, or if it not currently displayed, choose View > Connection Navigator.

    2. Double-click the Database folder to open the Create Database Connection Wizard.

    3. Complete the wizard, ensuring you complete the following:

      - On the Step 1 of 4: Type 1 page, enter soademo_ssn for the Connection Name.

      - On the Step 2 of 4: Authentication page, enter soademo for the Username and Password fields, and click Deploy Password.

      - Enter the appropriate values for where you installed the schema.

4.2.2 Task 2: Use a Database Adapter As a Service to Access the Database

In this task, you create a service that uses a database adapter to query the SSN table in the SOADEMO schema.

  1. In the Component Palette, select Services from the dropdown.

  2. Click and then drag the Database Adapter icon from the Component Palette and drop it in one of the yellow Services swim lanes of the SOAOrderBooking.bpel page.

    The Adapter Configuration Wizard appears.

  3. On the Welcome page, click Next.

  4. On the Step 1 of 2: Service Name page, in the Name field, enter getSsn, and then click Next.

  5. On the Step 2 of 2: Service Connection page:

    • Connection: Select the soademo_ssn database connection.

    • JNDI Name: Ensure the name is set to eis/DB/soademo_ssn. The name is case sensitive. Ensure that it correctly matches the case of the connection name.

  6. Click Next.

  7. On the Step 3 of 3: Operation Type page, select Perform an Operation on a Table, deselect all operations, except for Select, which is required.

  8. Click Next.

  9. In the Select Table page, click Import Tables.

    The Import Tables dialog appears.

  10. Click Query to display the tables.

  11. Select SSN, and click > to move this table to the Selected area.

  12. Click OK to save the setting, and return to the wizard.

  13. On the Step 4 of 7: Select Table page, the SOADEMO.SSN table displays. Click Next.

  14. On the Step 5 of 8: Define Primary Key page, select CUSTOMERID , and click Next.

  15. On the Step 6 of 8: Relationships, click Next, as there are no relationships.

  16. On the Step 7 of 8: Object Filtering page, leave the settings as they are, and click Next.

    When the Step 8 of 8: Define Selection Criteria page displays, notice the SQL query is set to:

    SELECT CUSTOMERID, SSN FROM SSN
    
    
  17. On the Step 8 of 8: Define Selection Criteria page, in the Parameters section, click Add to add a parameter.

    The Parameter Name dialog appears.

  18. Enter custIdToGet, and then click OK.

    At runtime, this parameter gets populated.

  19. Back on the Step 8 of 8: Define Selection Criteria page, in the SQL section, click Edit.

    The Expression Builder dialog appears.

  20. Click Add to add a where clause.

  21. In the Second Argument section, change the selection from Literal to Parameter, making sure the populated list underneath specifies custIdToGet, and then click OK.

  22. Back on the Step 8 of 8: Define Selection Criteria page, notice the SQL query changes to:

    SELECT CUSTOMERID, SSN FROM SSN WHERE (CUSTOMERID =#custIdToGet)
    
    
  23. Click Next.

  24. On the Finish page, click Finish to create the database adapter partner link.

    The Create Partner Link dialog appears and is automatically completed as follows:

    Element Value
    Name getSsn
    WSDL File file:DEMO_HOME/SOAOrderBooking/bpel/getSsn.wsdl
    Partner Link Type getSsn_plt
    Partner Role getSsn_role
    My Role unspecified

  25. Click OK.

    The SOAOrderBooking.bpel page updates with the getSsn service. By making this database adapter into a service, you have made it appear as a Web service to the SOAOrderBooking process. You can now invoke this service just as you would with any Web service, and it will return a row from the database.

    Description of dbpartnerlink.gif follows
    Description of the illustration dbpartnerlink.gif

4.2.3 Task 3: Create getCreditRating Scope Activity

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

  1. In the Component Palette, select Process Activities from the dropdown.

  2. Drag and drop a Scope activity from the Component Palette section below the CreditService activity, but above the RequiresManualApproval activity

  3. Rename this activity by double-clicking the name underneath the icon. Do not double-click the activity icon itself.

  4. In the edit field, change the name to getCreditRating.

  5. Click the Expand (+) icon to expand the getCreditRating scope.

4.2.4 Task 4: Create Invoke Activity to Call getSsn Service

To call a service from BPEL, you use the invoke activity. The invoke activity will call the service and pass it data, and in this case, wait for a response from the service with the return data.

To create an invoke activity:

  1. Drag and drop an Invoke activity from the Component Palette section inside the getCreditRating scope activity.

  2. Rename this activity by double-clicking name underneath the icon. Do not double-click the invoke icon itself.

  3. In the edit field, change the name to invokeGetSsn.

  4. Drag the mouse from the left side of invokeGetSsn to the getSsn database adapter service.

    Description of invokegetssn.gif follows
    Description of the illustration invokegetssn.gif

    The Edit Invoke dialog appears and is automatically filled in with the following information:

    Element Value
    Name invokeGetSsn
    Partner Link getSsn
    Operation getSsnSelect_custIdToGet

  5. Click the Automatically Create Input Variable icon. It is the first icon to the right of the Input Variable field.

    Description of editinvoke.gif follows
    Description of the illustration editinvoke.gif

    The Create Variable dialog appears with the input variable. A variable named invokeGetSsn_getSsnSelect_custIdToGet_InputVariable is automatically created in the Name field. This variable is automatically assigned a message type.

    The variable name is based on the invoke activity (invokeGetSsn), database adapter (getSsn), and database adapter parameter (custIdToGet).

  6. Leave Global Variable selected, and click OK.

    The Edit Invoke dialog populates with the variable in the Input Variable field.

  7. Click the Automatically Create Output Variable icon. It is the first icon to the right of the Output Variable field

    The Create Variable dialog appears with the output variable. A variable named invokeGetSsn_getSsnSelect_custIdToGet_OutputVariable is automatically created in the Name field. This variable is automatically assigned a message type.

  8. Leave Global Variable selected, and click OK.

    The Edit Invoke dialog populates with the variable in the Output Variable field.

    These variables provide input and output data for the getSsn service.

  9. Click OK to save the variable settings.

4.2.5 Task 5: Assign Value to Input Variable

You now create an assign activity to take the customer ID and assign it to the input variable invokeGetSsn_getSsnSelect_custIdToGet_InputVariable, which in turn sends a request to the getSsn service.

  1. Drag and drop an Assign activity from the Component Palette section to above the invokeGetSsn invoke activity and inside the getCreditRating scope activity.

    An assign activity references variables in an invoke activity, which is why you create it after creating the invoke activity.

  2. Rename this activity by double-clicking name underneath the icon. Do not double-click the invoke icon itself.

  3. In the edit field, enter assignCustID.

  4. Double-click the assignCustID activity.

    The Assign window displays.

    Description of assign.gif follows
    Description of the illustration assign.gif


    Tip:

    When using these type of windows in JDeveloper, do not click the X icon to apply changes. The X icon removes your changes. You must click OK to apply changes. If you cannot see the OK button, scroll down until you see it.

  5. From the Create menu, select Copy Operation.

    The Create Copy Operation dialog appears. It enables you to create a copy rule. In this dialog, you will specify a rule for populating the database adapter parameter (custIdToGet) with CustID in the input variable invokeGetSsn_getSsnSelect_custIdToGet_InputVariable.

  6. On the From side, expand Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns4:PurchaseOrder.

  7. Select ns4:CustID. Your system may show a different prefix than ns4.

    Description of createcopy.gif follows
    Description of the illustration createcopy.gif

  8. On the To side, expand Variables > invokeGetSsn_getSsnSelect_custIdToGet_InputVariable > getSsnSelect_custIdToGet_inparameters > ns32:getSsnSelect_custIdToGetInputParameters.

  9. Select ns32:custIdToGet. Your system may show a different prefix than ns32.

    Description of createcopy2.gif follows
    Description of the illustration createcopy2.gif

  10. Click OK.

    The Copy Operation tab in the Assign window updates to show the rule.

    Description of assign2.gif follows
    Description of the illustration assign2.gif

  11. Back in the Assign window, scroll-down and click OK.

    The SOAOrderBooking.bpel page should now look like the following:

    Description of getcreditrating.gif follows
    Description of the illustration getcreditrating.gif


    Summary:

    You created a getCreditRating scope activity that takes the customer ID provided by the SOAOrderBooking process and assigns it to the input variable, invokeGetSsn_getSsnSelect_custIdToGet_InputVariable. The input variable is passed as input to the getSsn service, which in turn returns the Social Security number to the output variable, invokeGetSsn_getSsnSelect_custIdToGet_OutputVariable. Next, you will create a CreditRatingService, and assign this output variable as input to that Web service.

4.2.6 Task 6: Install the Credit Rating Service

At this point in the procedure, you have modified the BPEL process to extract the customer's Social Security number from the database. The next step is to pass the Social Security number to the credit rating service, which returns the credit rating.

In this task, you install the credit rating service. The service is called CreditRatingService and is one of the samples shipped when you install Oracle SOA Suite. The following steps can also be used to install any of the many other samples that also shipped.

  1. Select Start > All Programs > Oracle - Oracle - soademo > Oracle BPEL Process Manager > Developer Prompt.

    A command prompt displays. Notice you are in the samples directory.

  2. Enter the following command:

    cd utils\CreditRatingService
    
    
  3. Enter following command:

    ant
    
    

    This command runs the ant script to install the CreditRatingService service. It takes 30 to 60 seconds to run the script.

    When you run ant, the script looks in the current directory for a build.xml file, which contains ant scripts for installing the sample. You can explore the samples directory and any directories under it. Anywhere there is a build.xml file, you can simply run ant to install that sample.

  4. Enter exit to close the command window.

    CreditRatingService is now implemented as a BPEL process. Whenever you create a BPEL process, it is exposed as a service. This means there is now a service called CreditRatingService that can be invoked by anything that can invoke a service. In the next task, you will invoke that service from the SOAOrderBooking process.

If you receive an authentication error when you run ant, it is probably because you are using a password other than welcome1. To resolve this issue:

  1. Use a text editor and open:

    ORACLE_HOME\bpel\utilities\ant-orabpel.properties
    
    
  2. Modify the value of admin.password from welcome1 to the password you are using.

4.2.7 Task 7: Create CreditRatingService Partner Link

In this task, you create a partner link to a Web service that maintains ratings for Social Security numbers.

  1. Drag and drop PartnerLink into one of the yellow Services swim lanes of the SOAOrderBooking.bpel page.

    The Create Partner Link dialog appears.

  2. Provide values for the elements as follows:

    Element Value
    Name CreditRatingService
    WSDL File
    1. Click the Service Explorer flashlight icon.
    2. In the Service Explorer dialog, expand BPEL Services > OrderBookingIS > processes > default.

    3. Select CreditRatingService.

    4. Click OK.

    Partner Link Type CreditRatingService
    Partner Role CreditRatingServiceProvider
    My Role unspecified

  3. Click OK.

    The SOAOrderBooking.bpel page updates with the CreditRatingService partner link.

    Description of creditratingservice.gif follows
    Description of the illustration creditratingservice.gif

4.2.8 Task 8: Create Invoke Activity to Call CreditRatingService

In this task, you create an invoke activity to send request data from the SOAOrderBooking process to the CreditRatingService partner link and receive a response.

To create the invoke activity:

  1. Drag and drop an Invoke activity from the Component Palette section below the invokeGetSsn activity inside the getCreditRating scope activity.

  2. Rename this activity by double-clicking name underneath the icon. Do not double-click the invoke icon itself.

  3. In the edit field, change the name to invokeCreditRatingService.

  4. Drag the mouse from the left side of invokeCreditRatingService to the CreditRatingService partner link.

    Description of invokecreditrating.gif follows
    Description of the illustration invokecreditrating.gif

    The Edit Invoke dialog appears and is automatically filled in with the following information:

    Element Value
    Name invokeCreditRatingService
    Partner Link CreditRatingService
    Operation process

  5. Click the Automatically Create Input Variable icon. It is the first icon to the right of the Input Variable field.

    The Create Variable dialog appears with the input variable. A variable named invokeCreditRatingService_process_InputVariable is automatically created in the Name field. This variable is automatically assigned a message type.

    The variable name is based on the invoke activity (invokeCreditRatingService) and operation (process). This variable provides input data to the CreditRatingService service.

  6. Leave Global Variable selected, and click OK.

    The Edit Invoke dialog populates with the variable in the Input Variable field.

  7. Click the Automatically Create Output Variable icon. It is the first icon to the right of the Output Variable field.

    The Create Variable dialog appears with the output variable. A variable named invokeCreditRatingService_process_OutputVariable is automatically created in the Name field. This variable is automatically assigned a message type.

  8. Leave Global Variable selected, and click OK.

    The Edit Invoke dialog populates with the variable in the Output Variable field.

    This variable provides output data from the CreditRatingService service.

  9. In the Edit Invoke dialog, click OK to save the variable settings.

4.2.9 Task 9: Assign Data to the Input Variable for CreditServiceRating

You now create an assign activity to take the Social Security number from the invokeGetSsn_getSsnSelect_custIdToGet_OutputVariable variable and assign it to the input variable invokeCreditRatingService_process_InputVariable, which in turn sends a request to CreditRatingService for the Social Security number.

  1. Drag and drop an Assign activity from the Component Palette section to above the invokeCreditRatingService invoke activity, but below the invokeGetSsn invoke activity.

  2. Rename this activity by double-clicking name underneath the icon. Do not double-click the assign icon itself.

  3. In the edit field, enter assignSsn.

  4. Double-click the assignSsn activity.

    The Assign window displays.

  5. From the Create menu, select Copy Operation.

    The Create Copy Operation dialog appears. Previously, you used the database adapter to retrieve the Social Security number from the database. To use that Social Security number and pass it to CreditRatingService, on the From side, you specify to take the Social Security number from the variable that was returned by getSsn.

  6. On the From side, expand Variables > invokeGetSsn_getSsnSelect_custIdToGet_OutputVariable (of the database adapter) > SsnCollection > ns32:SsnCollection. Your system may show a different prefix than ns32.

  7. Select ns32:ssn, where ssn represents the ssn column in the SSN table of the SOADEMO schema.

    Description of createcopy3.gif follows
    Description of the illustration createcopy3.gif

  8. On the To side, expand Variables > invokeCreditRatingService_process_InputVariable > payload.

  9. Select ns33:ssn. Your system may show a different prefix than ns32.

    Description of createcopy4.gif follows
    Description of the illustration createcopy4.gif

  10. Click OK.

    The Copy Operation tab in the Assign window updates to show the rule.

    Description of assign3.gif follows
    Description of the illustration assign3.gif

  11. Back in the Assign window, scroll-down and click OK.

    The SOAOrderBooking.bpel page should now look like the following:

    Description of getcreditrating2.gif follows
    Description of the illustration getcreditrating2.gif

  12. Choose File > Save to save your work.


    Summary:

    You created a getCreditRating scope activity that takes the customer ID provided by the SOAOrderBooking process and assigns it to the input variable, invokeGetSsn_getSsnSelect_custIdToGet_InputVariable. The input variable is passed as input to the getSsn service, which in turn returns the Social Security number to the output variable, invokeGetSsn_getSsnSelect_custIdToGet_OutputVariable. Next, you assigned this variable as input to a CreditRatingService Web service, which in turn returns the rating for the Social Security number to the output variable, invokeCreditRatingService_process_OutputVariable.

4.2.10 Task 10: Redeploy SOAOrderBooking

Now that you have modified and saved the BPEL process, it is time to test it. To do that, deploy it to the server, and then place a new order, which will use the updated BPEL process.

To redeploy SOAOrderBooking:

  1. In the Application Navigator, expand SOAOrderBooking > Resources.

  2. In the Application Navigator, right-click build.xml, and select Run Ant.

    The Run Ant dialog appears.

  3. Click the Properties tab, and if any properties exist, remove them.

  4. In the Property Files section, click Add and select the build.properties file.

  5. Click Open and click OK.

    This action starts the deployment process, which may take anywhere from 30 to 60 seconds. You can monitor the progress in the Messages pane, in the Apache Ant - Log tab, in the Apache Ant sub-tab. You will know the deployment is complete when you see the text BUILD SUCCESSFUL.

4.2.11 Task 11: Test New Functionality by Placing a New Order

To place an order in the Web client:

  1. Click the Browse products and create a new order link.

    The Browse and Select Items page appears. It lists the electronic products available for sale.

    Description of browse.gif follows
    Description of the illustration browse.gif

  2. Select the PlayStation 2 Video Game System, priced at $199.00, and click View Details.

    The Item Details page appears. It displays detailed information about the product, and enables the user to select a quantity to add to their cart.

    Description of item.gif follows
    Description of the illustration item.gif

  3. In the Quantity list, select 1, and click Add to cart.

  4. Click Go to Shopping Cart.

    The Shopping Cart Contents page appears.

    Description of shoppingcart.gif follows
    Description of the illustration shoppingcart.gif

  5. Click Place order to submit the order.

    The welcome page updates with an Order Submitted message.

    Description of ordersubmit.gif follows
    Description of the illustration ordersubmit.gif

4.2.12 Task 12: View the Order Approval in the Oracle BPEL Control

  1. If the Oracle BPEL Control is not running, select Start > All Programs > Oracle - Oracle - soademo > Oracle BPEL Process Manager > BPEL Control.

  2. When prompted, enter oc4jadmin in the Username field and welcome1 in the Password field.

    The Dashboard tab updates to show the order has completed.

    Description of bpelconsolecreditrat.gif follows
    Description of the illustration bpelconsolecreditrat.gif

    Notice the addition of the CreditRatingService, which you just created.

  3. Click the Instances tab.

  4. Click the last instance of SOAOrderBooking.

  5. Click the Flow subtab, and the scroll to the getCreditRating scope.

    Description of bpelconsolegetcredit.gif follows
    Description of the illustration bpelconsolegetcredit.gif

  6. Click invokeCreditRatingService.

    The Activity Audit Trail window displays. It shows Social Security number (ssn) 123456789 was returned for customer ID (customerid) 10 from the previous activity. For this activity, it shows CreditRatingService returned a rating of 560.

    Description of activityaudittrail.gif follows
    Description of the illustration activityaudittrail.gif

  7. Close the Activity Audit Trail window.

  8. Click the Dashboard tab to navigate back to the main view.

4.3 Introduction to the JDeveloper ESB Designer

This section provides a brief introduction to the JDeveloper ESB Designer. In the next section, Section 4.4, you will make modifications to the FulfillmentESB project.

To familiarize yourself with the JDeveloper ESB Designer:

  1. In the Applications Navigator of JDeveloper, expand SOADEMO > FulfillmentESB > Resources.

  2. Double-click FulfillmentESB.esb.

    The JDeveloper ESB Designer displays the following in the flow:

    • OrderFulfillment routing service, which routes messages to Shipment and FulfillmentBatch

    • Shipment routing service, which is responsible for sending shipment information to either USPS (USPSShipment) or Fedex (FedexShipment).

    • USPSShipment file adapter

    • FedexShipment database adapter

    • FulfillmentBatch JMS adapter, which is responsible for storing all fulfillment orders for overnight batch processing

    Description of fulfillmentesb.gif follows
    Description of the illustration fulfillmentesb.gif

  3. In Shipment, hover your mouse over the filter icons.

    The first filter shows the following for orders to be shipped by Fedex:

    /inp1:PurchaseOrder/inp1:OrderInfo/inp1:OrderPrice >= 500
    
    

    The second filter shows the following for orders to be shipped by USPS

    /inp1:PurchaseOrder/inp1:OrderInfo/inp1:OrderPrice < 500
    
    

    As described and shown in previous chapters, after an order has been approved, Fulfillment sends the order to the appropriate shipping target. Orders under $500 are routed to USPS; orders $500 and over are routed to Fedex using these filters. USPS orders are sent through a file adapter and written to a file. Fedex orders are sent through database adapter and written to the FEDEX table in the database.

4.4 Adding a New Shipping Target to FulfillmentESB Project

To familiarize yourself with designing ESB elements in the JDeveloper ESB Designer, you will create a third shipping target for DHL that uses a SOAP service for orders over $1000.

In this scenario, you will perform the following tasks:

4.4.1 Task 1: Add the DHLShipment Service to ESB

To create the DHLShipment service:

  1. Double-click the Shipment routing service

    The Fullfillent_Shipment.esbsvc page displays with Routing Service information.

    Description of routingservice.gif follows
    Description of the illustration routingservice.gif

  2. In the Routing Rules section, click the Expand the Routing Rule icon (+) sign to expand it.

  3. Scroll to the far right, and click the green + icon to add another routing rule.

    The Browse Target Service Operation dialog appears.

  4. Expand Services at ESB Server Connection: OracleBookingIS > BPEL System > default > DHLShipment > DHLShipment_1_0.

    DHLShipment is a service that you deployed in Chapter 2.

  5. Under DHLShipment_1_0, click initiate.

    Description of browsetargetservice.gif follows
    Description of the illustration browsetargetservice.gif

  6. Click OK in the Browse Target Service Operation dialog.

    The Routing Rules section now looks like this:

    Description of routingrules.gif follows
    Description of the illustration routingrules.gif

  7. Create a filter to direct orders $1000 and over to DHLShipment.

    1. Click the filter icon for the DHLShipment rule.

      The Expression Builder dialog appears

    2. In the WSDL Message section, expand PurchaseOrder > inp1:PurchaseOrder > inp1:OrderInfo, and then select inp1:OrderPrice.

      The Content Preview box also shows the path: /inp1:PurchaseOrder/inp1:OrderInfo/inp1:OrderPrice

    3. Click Insert Into Expression.

      The path appears in the Expression box at the top of the dialog.

    4. In the Expression box, append >= 1000 to the path, so that it now reads /inp1:PurchaseOrder/inp1:OrderInfo/inp1:OrderPrice >= 1000.

      Description of expressionblder.gif follows
      Description of the illustration expressionblder.gif

    5. Click OK in the Expression Builder.

      The Routing Rules section now looks like this:

      Description of routingrules.gif follows
      Description of the illustration routingrules.gif

  8. Create a transformation so that the DHLShipment SOAP service gets the proper information:

    1. In the Routing Rules section, click the transformation icon.

      The Request Transformation Map dialog appears.

    2. Select Use Existing Mapper File, and click the flashlight icon.

      The Select XSL Transformation File dialog appears.

    3. Expand Project XSL Files, and select PurchaseOrder_To_DHLShipmentProcessRequest.xsl.

      Description of selecttrans.gif follows
      Description of the illustration selecttrans.gif

    4. Click OK to return back to the Request Transformation Map dialog.

      Description of requesttransmap.gif follows
      Description of the illustration requesttransmap.gif

    5. In the Request Transformation Map dialog, click OK.

    6. Scroll to the far lower right, and click Asynchronous.

      The Routing Rules section now looks like this:

      Description of routingrulesfin.gif follows
      Description of the illustration routingrulesfin.gif

    7. Select File > Save to save your work.

    8. Close the Fulfillment_Shipment.esbsvc window by hovering your mouse over the tab and pressing X.

      The FulfillmentESB.esb page updates. From Shipment, you should now see three arrows: one going to FedexShipment, a second one going to USPSShipment, and a third one going to DHLShipment.

      If you hover your mouse over the filter icon third filter in Shipment, it shows the filter used for orders to be shipped by DHL:

      /inp1:PurchaseOrder/inp1:OrderInfo/inp1:OrderPrice >= 1000
      
      Description of fulfillmentesbdhlconn.gif follows
      Description of the illustration fulfillmentesbdhlconn.gif

4.4.2 Task 2: Redeploy FulfillmentESB

Now that you have modified and saved the FulfillmentESB, it is time to test it. To do that, deploy it to the server, and then place a new order for over $1000 to see if it is sent DHL.

To redeploy FulfillmentESB:

  1. In the Application Navigator, right-click FulfillmentESB, and select Register to ESB > OrderBookingIS.

  2. Click OK in the Summary dialog.

4.4.3 Task 3: Test New Functionality By Placing a New Order

To place an order in the Web client:

  1. In the welcome page, click the Browse products and create a new order link.

    The Browse and Select Items page appears.

  2. Click the Next 10 link, and select Ipod Mini 2 Gb.

    Description of browse2.gif follows
    Description of the illustration browse2.gif

  3. Click View Details.

    The Item Details page appears. It displays detailed information about the product, and enables the user to select a quantity to add to their cart.

    Description of item2.gif follows
    Description of the illustration item2.gif

  4. In the Quantity list, select 10, and click Add to cart.

  5. Click Go to Shopping Cart.

    The Shopping Cart Contents page appears.

    Description of shoppingcart2.gif follows
    Description of the illustration shoppingcart2.gif

  6. Click Place order to submit the order.

    The welcome page updates with an Order Submitted message.

    Description of ordersubmit.gif follows
    Description of the illustration ordersubmit.gif

4.4.4 Task 4: View the Order in the Oracle BPEL Control

  1. If the Oracle BPEL Control is not running, select Start > All Programs > Oracle - Oracle - soademo > Oracle BPEL Process Manager > BPEL Control.

  2. When prompted, enter oc4jadmin in the Username field and welcome1 in the Password field.

  3. The Dashboard tab shows the order completed.

    In Section 3.2, "Increasing Approval Order Amount from $1000 to $2000 and Resubmitting Order", you changed the approval amount. Therefore, the order should complete without approval. If you did not complete Section 3.2, then you must use the Worklist Application to approve the order. See Section 3.2 for further information on using the Worklist Application.

4.4.5 Task 5: View the DHLShipment Status in the Oracle ESB Control

  1. If the Oracle ESB Control is not running, select Start > All Programs > Oracle - Oracle - soademo > Oracle ESB > ESB Control.

  2. When prompted, enter oc4jadmin in the Username field and welcome1 in the Password field.

  3. Click the Instances icon, at the top of the screen, toward the right-hand side.

    Description of instances_icon.gif follows
    Description of the illustration instances_icon.gif

    The Instances pane appears on the left-hand side. The Status column shows the OrderBooking and Fulfillment instances were successfully completed.

    Description of instancesdhl.gif follows
    Description of the illustration instancesdhl.gif

  4. Click the instance at the top of the list.

    This view shows the Shipment service routed the over $1000 order to the new DHLShipment service, as shown by the green line. However, also notice the green line extends from Shipment to FedexShipment. In other words, the product will be shipped by two different shipment vendors. This quick start did not ask you to adjust the routing rule for Fedex, which accepts orders for $500 or above. Therefore, you need to be careful when adding ESB elements to avoid unexpected results.

    In a real-world enterprise, you would need to alter the filter rule for Fedex, so orders $500 and up to $1000 are routed to Fedex. By making this change, orders for $1000 and over would route only to DHL. To gain further experience with ESB, feel free to make this change yourself.

    Description of instancesfulfillment2.gif follows
    Description of the illustration instancesfulfillment2.gif

  5. At the bottom of the Fulfillment instance, click the Expand icon.

    Description of expand.gif follows
    Description of the illustration expand.gif

  6. Click the DHLShipment service.

    Description of instancesfulfillment3.gif follows
    Description of the illustration instancesfulfillment3.gif

  7. Click the Navigate to BPEL instance link to see the integration with the Oracle BPEL Control.

    The Oracle BPEL Control displays with the Flow view for the DHLShipment service.

    Description of bpelconsole_esb3.gif follows
    Description of the illustration bpelconsole_esb3.gif

4.5 Learning More About Oracle SOA Suite

To learn about Oracle SOA Suite, refer to the following resources: