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

8 Adding a Flow to Update Orders

In this chapter, you provide functionality for updated orders. You create a mediator service component to publish business event OrderUpdateEvent and send the order ID for the order to the OrderProcessor BPEL process. You create a second mediator service component to subscribe to the business event, send the order ID to the StoreFrontService service, and wait for the StoreFrontService service to respond with updated order information.

This chapter contains the following sections:

8.1 Task 1: Copy Schema File Needed for Business Event

To obtain the schema:

  1. Copy OrderProcessor.xsd from directory DEMO_DOWNLOAD_HOME\CompositeServices\OrderBookingComposite\xsd to MY_FOD_HOME\CompositeServices\OrderBookingComposite\xsd. This schema file contains the additional updateOrderStatus schema element to create the business event.

  2. In the Application Navigator, click the Refresh icon.

8.2 Task 2: Create the UpdateOrderStatus Mediator Service Component to Publish the OrderUpdateEvent Business Event

To create business event OrderUpdateEvent and create a mediator to publish the business event:

  1. Drag a Mediator service component into the SOA Composite Editor. This service component enables you to subscribe to the business event.

  2. In the Name field, enter UpdateOrderStatus.

  3. From Template, select Interface Definition from WSDL.

  4. Select the Create Composite Service with SOAP Bindings.

  5. From the WSDL URL field, generate a WSDL file:

    1. Click the Generate WSDL from schema(s) icon.

    2. From the Create WSDL dialog, in the URL field, click the browse for schema file icon.

    3. In the Type Chooser dialog, expand Project Schema Files > OrderProcessor.xsd and select updateOrderStatus.

    4. Click OK.

    5. Back in the Create WSDL dialog, in the Namespace field, enter http://www.globalcompany.example.com/ns/OrderBookingService.

    6. Click OK and return to the Create Mediator dialog.

  6. Back in the Create Mediator dialog, click OK to create the mediator with the settings.

    Description of updateorder.gif follows
    Description of the illustration updateorder.gif

    The UpdateOrderStatus_ep SOAP service and the UpdateOrderStatus mediator display in the SOA Composite Editor composite.

    Description of updateorder2.gif follows
    Description of the illustration updateorder2.gif

8.3 Task 3: Create a Routing Rule to Initiate the Business Event

To create a routing rule to initiate the business event:

  1. Double-click the UpdateOrderStatus mediator.

  2. In the Routing Rules section of the Mediator Editor, from the Create dropdown list, select static routing rule to create a routing rule to initiate the business event.

    Description of updateorder3.gif follows
    Description of the illustration updateorder3.gif

  3. In the Target Type message dialog, click Event.

  4. In the Event Chooser dialog, click the Create new event definition file (edl) icon. It is the second icon to the right of the field.

  5. In the Event Definition name field, enter OrderEventsDefinition.

  6. In the Namespace field, enter http://www.globalcompany.example.com/ns/OrderBookingService.

  7. Create business event OrderUpdateEvent:

    1. From the Events table, click the Add an Event icon to add an event.

      The Add an Event dialog appears.

    2. Enter and select the following values:

      Element Value
      Element
      1. Click the Browse icon to select the payload.

        The Type Chooser dialog displays.

      2. Expand Project Schema Files > OrderProcessor.xsd and select updateOrderStatus.

      3. Click OK.

      Name OrderUpdateEvent

    3. Click OK to display the Event Definition dialog.

    4. Click OK to save settings.

      The Event Chooser dialog displays with the OrderUpdateEvent event.

    5. Click OK in the Event Chooser dialog.

      The Routing Rules updates with a routing rule to initiate business event OrderUpdateEvent.

      Description of updateorder5.gif follows
      Description of the illustration updateorder5.gif

  8. Modify the transformation used for the UpdateOrderStatus mediator service components, so that any service subscribing to this event receives input from the OrderUpdateEvent business event:

    1. Click the transformation icon next to the Transform Using field.

    2. In the Request Transformation Map dialog, select Create New Mapper File and leave the default file entry as updateOrderStatus_To_OrderUpdateEvent.xsl, and then click OK.

      The Data Mapper displays.

    3. On the Source:UpdateOrderStatus.wsdl (left) side, click and drag tns:orderId to orderId on the XSLT File: OrderProcessor.xsd (right) side.

    4. On the Source:UpdateOrderStatus.wsdl (left) side, click and drag tns:orderStatus to orderStatus on the XSLT File: OrderProcessor.xsd (right) side. The namepace in your environment may vary.

      The Data Mapper dialog should look like the following now.

      Description of updateorder6.gif follows
      Description of the illustration updateorder6.gif

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

    6. Click X in the updateOrderStatus_To_OrderUpdateEvent.xsl tab to close the Data Mapper.

    7. With the UpdateOrderStatus.mplan tab back in focus, in the Routing Rules section, you should see file updateOrderStatus_To_OrderUpdateEvent.xsl in the Transform Using field.

  9. Click X in the UpdateOrderStatus.mplan tab to close Mediator Editor.

8.4 Task 4: Create the OrderUpdateEventMediator Mediator Service Component to Subscribe to the OrderUpdateEvent Business Event

To create a mediator to subscribe to the OrderUpdateEvent business event and initiate the StoreFrontService service:

  1. Drag a Mediator service component into the SOA Composite Editor. This service component enables you to subscribe to the business event.

  2. In the Name field, enter OrderUpdateEventMediator.

  3. From the Templates list, select Subscribe to Events.

    The window refreshes to display an events table.

  4. Click the Subscribe to a new event icon to display the Event Chooser dialog.

  5. With the OrderUpdateEvent event selected, click OK.

    You are returned to the Create Mediator dialog.

    Description of orderupdate.gif follows
    Description of the illustration orderupdate.gif

  6. In the Create Mediator dialog, click OK.

    The OrderUpdateEventMediator mediator displays in the SOA Composite Editor. The icon on the left side that indicates that mediator is configured for an event subscription.

    Description of updateorder7.gif follows
    Description of the illustration updateorder7.gif

8.5 Task 5: Create a Routing Rule to Send Order Updates to the StoreFrontService service

To create routing rules to send the order ID to the StoreFrontService service, and wait for the StoreFrontService service to respond with updated order information.

  1. Double-click the OrderUpdateEventMediator mediator.

  2. In the Routing Rules section of the Mediator Editor, from the Create dropdown list, select static routing rule to create a routing rule to initiate the business event.

  3. In the Target Type message dialog, click Service.

  4. In the Target Services dialog, expand References > StoreFrontService and select getOrderInfoVOSDO and then click OK.

  5. Modify the parameter transformation so that the StoreFrontService service receives the order ID information from the mediator:

    1. Click the transformation icon next to the Transform Using field.

    2. In the Request Transformation Map dialog, select Create New Mapper File and leave the default file entry as OrderUpdateEvent_To_getOrderInfoVOSDO.xsl, and then click OK.

      The Data Mapper displays.

    3. On the Source:OrderProcessor.xsd (left) side, click and drag orderId to types:orderId on the StoreFrontService.wsdl (right) side.

      The Data Mapper dialog should look like the following now.

      Description of updateorder8.gif follows
      Description of the illustration updateorder8.gif

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

    5. Click X in the OrderUpdateEvent_To_getOrderInfoVOSDO.xsl tab to close the Data Mapper.

    6. With the OrderUpdateEventMediator.mplan tab back in focus, in the Routing Rules section, you should see file OrderUpdateEvent_To_getOrderInfoVOSDO.xsl in the Transform Using field.

  6. In the Synchronous Reply section of the Mediator Editor, click the Browse for target service operations icon:

    Description of updateorder9.gif follows
    Description of the illustration updateorder9.gif

  7. In the Target Type message dialog, click Service.

  8. In the Target Services dialog, expand References > StoreFrontService and select updateOrderInfoVOSDO and then click OK.

  9. Modify the parameter transformation so that the StoreFrontService service receives the proper information from the mediator:

    1. Click the transformation icon next to the Transform Using field.

    2. In the Request Transformation Map dialog, select Create New Mapper File and leave the default file entry as getOrderInfoVOSDOResponse_To_updateOrderInfoVOSDO.xsl, and then click OK.

      The Data Mapper displays.

    3. On the Source (left) side, click and drag types:getOrderInfoVOSDOResponse > types:result to types:updateOrderInfoVOSDO > types:orderInfoVO1 on the XSLT File right side.

      The Auto Map Preferences dialog prompts to perform automatic mapping of the node.

    4. Deselect option Match Elements Considering their Ancestor names.

    5. Leave the default settings for the other options, and then click OK.

    6. On the Source:StoreFrontService.wsdl side, expand types:results > ns4:OrderItemsInfoVO.

    7. On the XSLT File:StoreFrontService.wsdl side, expand types:orderInfoVO1 > for-each > ns4:OrderItemsInfoVO. The namespace number values (for example, ns1, ns2) can vary.

      In the Data Mapper, you can now see how the data is transformed for an updated order.

      Description of updateorder10.gif follows
      Description of the illustration updateorder10.gif

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

    9. Click X in the getOrderInfoVOSDOResponse.xsl tab to close the Data Mapper.

    10. With the OrderUpdateEventMediator.mplan tab back in focus, in the Routing Rules section, you should see file getOrderInfoVOSDOResponse_To_updateOrderInfoVOSDO.xsl in the Transform Using field.

      Description of updateorder11.gif follows
      Description of the illustration updateorder11.gif

  10. Click X in the OrderUpdateEventMediator.mplan tab to close Mediator Editor.

8.6 Task 6: Redeploy the OrderBookingComposite Composite

To redeploy the OrderBookingComposite composite:

  1. In the Application Navigator, right-click OrderBookingComposite and select Deploy > OrderBookingComposite > to MyAppServerConnection.

    The SOA Deployment Configuration Dialog displays.

  2. Select Overwrite any existing composite with the same revision ID to overwrite the composite you previously deployed.

  3. When prompted with the Authorization Request dialog, enter weblogic in the Username field and the password in the Password field.

    In SOA - Log, a series of validations display, followed by:

    BUILD SUCCESSFUL
    Total time: nn seconds
    

8.7 Task 7: Initiate a Test Instance for the OrderBookingComposite Composite

Initiate a test instance of the OrderBookingComposite composite, as you have done previously. See Section 5.7.6, "Task 6: Initiate a Test Instance for the OrderBookingComposite Composite" for further information on creating a test instance. For this test instance, make the following adjustments: