Skip Headers
Oracle® Fusion Middleware Tutorial for Running and Building an Application with Oracle SOA Suite
11g Release 1 (11.1.1)

Part Number E10275-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Feedback page
Contact Us

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

4 Creating the OrderBookingComposite Composite

This chapter describes how to create the OrderBookingComposite composite of the WebLogic Fusion Order Demo application. This chapter assumes you have performed all the tasks in Chapter 3, "Creating the SOA Application."

This chapter contains the following sections:

4.1 About the OrderBookingComposite Composite

Chapter 1, "Introduction to the SOA Sample Application," describes the flow of the OrderBookingComposite composite. Figure 4-1 shows the OrderBookingComposite composite in the SOA Composite Editor.

Figure 4-1 OrderBookingComposite

Description of Figure 4-1 follows
Description of "Figure 4-1 OrderBookingComposite "

The left swim lane of the SOA Composite Editor contains references that send messages to external services. Table 4-1 describes the services referenced by service components within the OrderBookingComposite composite.

Table 4-1 Exposed Services in OrderBookingComposite Composite

Exposed Services Description

orderprocessor_client_ep

This service provides an entry into the OrderProcessor BPEL process, providing an entry point into the OrderBookingComposite composite to process electronic orders from the Store Front module.

UpdateOrderStatus_ep

This service provides an entry into the UpdateOrderStatus mediator.


The designer (middle section) of the SOA Composite Editor contains service components. Table 4-2 describes the service components used in the OrderBookingComposite composite.

Table 4-2 Service Components in OrderBookingComposite Composite

Service Component Type Description

ApprovalHumanTask

Human Task

This component enables a manager to approve or reject an order.

EvaluatePreferredSupplierRule

Business Rule

This component chooses the shipment supplier based on the lowest bid.

FulfillOrder

Mediator

This component routes order information to either the USPSShipment file adapter and the FulfillmentBatch JMS adapter.

InternalWarehouseService

BPEL

This component provides a delivery date (to compete with the price from PartnerSupplierMediator mediator). This process is used to demonstrate invoking an asynchronous process from BPEL.

OrderPendingEvent

Mediator

This component subscribes to event NewOrderSubmitted from the Oracle Application Development Framework (ADF) Business Component of StoreFrontService, which contains the order ID. OrderPendingEvent consumes the event, transforms it, and passes the order ID to the OrderProcessor BPEL process.

OrderProcessor

BPEL

This component receives the order ID information, processes the order, and orchestrates all necessary services within the enterprise to complete the order.

OrderUpdateEventMediator

Mediator

This component subscribes to event OrderUpdateEvent from the UpdateOrderStatus mediator. The OrderUpdateEventMediator transforms the event and passes the order ID from the OrderProcessor BPEL process to StoreFrontService, which sends back the order status and order information, which the mediator transforms.

PartnerSupplierMediator

Mediator

This component initiates the PartnerSupplierService, which options a delivery date and order total from theExternalPartnerSupplier BPEL process in the PartnerSupplierComposite for a given order from an external partner warehouse (to compete with the price obtained from InternalWarehouseService BPEL process.

RequiresApprovalRule

Business Rule

This business rule determines if manual approval is required.

UpdateOrderStatus

Mediator

This component publishes business event OrderUpdateEvent. The mediator transforms the order ID and status and passes it to the OrderProcessor BPEL process. The OrderUpdateEventMediator consumes the business event.


The right swim lane of the SOA Composite Editor contains references that send messages to external services. Table 4-3 describes the services referenced by OrderBookingComposite composite.

Table 4-3 References in OrderBookingComposite Composite

Service Component Type Description

CreditCardAuthorization

Web Service

This synchronous service provides the credit card type, account number, and purchase amount to the OrderProcessor BPEL process.

StoreFrontService

Web Service

This synchronous service provides customer ID information to the OrderProcessor BPEL process.

FulfillmentBatch

JMS Adapter

This adapter provides a JMS queue for storing all fulfillment orders for overnight batch processing. The JMS adapter is used to write the order information to the specified JMS queue.

PartnerSupplierService

Web Service

This asynchronous service provides the lowest bid for the order from PartnerSupplierComposite composite.

NotificationService

Web Service

This synchronous service provides an Oracle Messaging Service for notifying the customer of the order.

USPSShipment

File Adapter

This adapter ships the order using USPS.


4.2 Approaches for Creating OrderBookingComposite

When creating a complex composite, you can use the following approaches for building:

For the tutorial, you use the bottom-up approach, so you can learn to build the composite in discrete segments.

4.3 Creating the OrderBookingComposite Project

In this procedure, you create the OrderBookingComposite project and the OrderProcessor BPEL process. This procedure contains the following tasks:

4.3.1 Task 1: Create the OrderBookingComposite Project

To create the OrderBookingComposite project for the WebLogic Fusion Order Demo application:

  1. Right-click the WebLogicFusionOrderDemo application name in the Application Navigator and select New Project.

    The New Gallery dialog displays.

  2. From either the All Technologies tab or the Current Project Technologies tab, in the Categories tree, select SOA Tier.

  3. In the Items list, select SOA Project.

  4. Click OK.

    The Create SOA Project dialog appears.

  5. Enter the following values:

    Element Value
    Project Name OrderBookingComposite
    Directory Accept the default directory location, MY_FOD_HOME\CompositeServices\OrderBookingComposite. Oracle JDeveloper creates this directory for all the contents of the OrderBookingComposite project.
    Project Technologies SOA

  6. Click Next.

  7. In the Configure SOA Settings page, from the Composite Template section, select Composite With BPEL.

  8. Click Finish.

    The Create BPEL Process dialog displays.

4.3.2 Task 2: Create the OrderProcessor BPEL Process

Now, continue with the creation of the OrderProcessor BPEL process:

  1. In the Create BPEL Process dialog, enter the following values:

    Element Value
    Name OrderProcessor
    Namespace http://www.globalcompany.example.com/ns/OrderBookingService
    Template Asynchronous BPEL Process
    Expose as a SOAP service Select this check box to create a BPEL process connected to an inbound SOAP service binding component.

  2. In the Input field, import the complete schema located in the DEMO_DOWNLOAD_HOME directory.

    1. In the Input field, click the Browse Input Elements icon.

      The Type Chooser dialog displays.

    2. Click the Import Schema File icon.

      The Import Schema File dialog displays.

    3. Click the Browse Resources icon to the right of the URL field.

      The SOA Resource Browser displays.

    4. Select File System and in the Location section, search for InternalWarehouse.xsd in DEMO_DOWNLOAD_HOME/CompositeServices/OrderBookingComposite/xsd and click OK.

    5. In the Import Schema dialog, ensure the InternalWarehouse.xsd now displays in the URL field and the Copy to Project option is selected, and then click OK.

      The Localized Files dialog displays, prompting you to import the InternalWarehouse.xsd schema file.

    6. Deselect the Maintain original directory for imported files option and click OK to import the files.

      The Type Chooser dialog displays.

    7. Expand Project Schema Files > InternalWarehouse.xsd and select WarehouseRequest and then click OK.

  3. In the Create BPEL Process dialog, import the elements from the InternalWarehouse.xsd file for the output:

    1. In the Output field, click the Browse Output Elements icon.

      The Type Chooser dialog displays.

    2. Expand Project Schema Files > InternalWarehouse.xsd and select WarehouseResponse and then click OK.

  4. In the Create BPEL Process dialog, click OK.

    The OrderProcessor BPEL process displays in the designer. Notice, too, the OrderBookingComposite project displays in the Application Navigator.

    Description of orderprocessbp.gif follows
    Description of the illustration orderprocessbp.gif

    In Chapter 5, "Creating the First Half of the OrderProcessor BPEL Process," you create services and building blocks for placing an order.

  5. Click the composite.xml tab to view OrderBookingComposite. SOAP service binding component orderprocessor_client_ep in the left swim lane provides the outside world with an entry point into the SOA composite application.

    Description of orderbooking.gif follows
    Description of the illustration orderbooking.gif

  6. Click the WebLogicFusionOrderDemo.jws tab to view the contents of the WebLogicFusionOrderDemo application

  7. From the Show list, select OrderBookingComposite to view the contents of the OrderBookingComposite application.

    Description of appover2.gif follows
    Description of the illustration appover2.gif

  8. Select Save All from the File main menu to save your work.

4.3.3 Task 3: Add the ADF Business Components Service Runtime Library

To add the ADF Business Components service run-time library:

  1. In the Application Navigator, right-click OrderBookingComposite and select Project Properties.

  2. Select Libraries and Classpath, and from the Libraries and Classpath page, and click Add Library.

  3. In the Add Library dialog, select BC4J Service Runtime, and then click OK.

  4. In the Libraries and Classpath page, click OK.

4.4 About the OrderProcessor Process

The OrderProcessor process represents the main flow in the WebLogic Fusion Order Demo application. It sends the order information to the appropriate services at the appropriate times. For example, it contacts the CreditAuthorizationService service to check the customer's credit card, and if the credit card is acceptable, it contacts the internal and external warehouses to get price quotes for the order.

The OrderProcessor project is a large project. This chapter begins by giving an overview of the major blocks in the project, and then it goes into detail on how to create each block.

Table 4-4 lists the major blocks in the OrderProcessor process:

Table 4-4 Major Blocks in the OrderProcessor Process

Block Type Description

receiveInput

Receive activity

This activity receives the order ID for incoming requests.

Scope_RetrieveOrder

Scope

This scope retrieves order information from the database. It uses a bind entity activity to point to order data in an Oracle Application Development Framework (ADF) Business Component data services provider.

Scope_RetrieveCustomerForOrder

Scope

This scope calls the StoreFrontService service to retrieve customer information.

Scope_AuthorizeCreditCard

Scope

This scope verifies that the customer has acceptable credit using the CreditCardAuthorizationService service.

Scope_CheckApprovalLimit

Scope

This scope does the following:

  • Initiates the RequiresApproval business rule that evaluates the amount of the order to determine whether an order must be approved by a manager.

  • For an order where approval is required, uses a switch to initiate the ApprovalHumanTask human task for a manager to approve or not approve the order.

    For approved orders, the OrderProcessor process continues with the rest of the activities. For rejected orders, the process throws a fault and does not continue.

  • For orders where approval is not required, the switch is not initiated.

  • Sets the variables for the price amount and credit card status used by the RequiresApprovalRule business rule.

Scope_RetrieveQuotes

Scope

This scope sends order information to two suppliers, an external partner warehouse and an internal warehouse, and the warehouses return their bids for the orders.

Scope_SelectPreferredSupplier

Scope

This scope initiates the SelectPreferredSupplier business rule for selecting a shipping supplier with the lowest bid.

Scope_FulfillOrder

Scope

This scope calls the FulfillOrder mediator component, which determines the shipping method for the order.

Scope_UpdateStatusToComplete

Scope

This scopes assigns a final status of complete to the order.

Scope_NotifyCustomerofCompletion

Scope

This scope uses the Oracle User Messaging Service to send an email to the customer who placed the order.

callbackClient

Invoke activity

This invoke activity notifies the client that it is done.


Figure 4-2 shows the OrderProcessor process in the BPEL Designer of the Oracle JDeveloper with the blocks minimized. Exercises in Chapter 5 and Chapter 6 expand the blocks to show their contents and describe how to create the blocks.

Figure 4-2 Minimized View of the Blocks in OrderProcessor

Description of Figure 4-2 follows
Description of "Figure 4-2 Minimized View of the Blocks in OrderProcessor "