< Previous | Next >

Building the request flow

Connect your request and response operations to define the end points of your mediation flow, and add mediation primitives to complete the flow.

The mediation primitives will do the following:
  • Retrieve the customer's subscription level from a database
  • Based on the subscription level, retrieve a service address from a database, and place the retrieved address in the target address element of the SMO header in the message.
  • Log the message
  • Transform the message to match the interface of the target reference
  • The callout node will route the message to the endpoint address stored in the target address element of the message header.

To create the mediation flow, follow these steps:

  1. Define the source and target operations by connecting them in the editor. Hover your mouse over the source getQuote operation. Drag the handle to the target getQuote operation.
  2. Click the source getQuote operation to view the request flow. Add mediation primitives in sequence from left to right, as follows:
    1. Expand the first primitive in the palette, and add a DatabaseLookup primitive onto the canvas, and rename it CustomerLookup.
    2. Add another DatabaseLookup primitive onto the canvas, and rename it ServiceAddressLookup.
    3. Add a MessageLogger primitive onto the canvas. Rename Message Logger to Log.
    4. Add an XSL Transformation primitive onto the canvas, and rename it InterfaceTransformation.
  3. Wire the primitives and nodes in sequence from left to right, as follows:
    • The output terminal of getQuote : StockQuoteService to the input terminal of CustomerLookup
    • The output terminal of CustomerLookup to the input terminal of ServiceAddressLookup
    • The output terminal of ServiceAddressLookup to the input terminal of Log
    • The output terminal of Log to the input terminal of InterfaceTransformation
    • The output terminal of InterfaceTransformation to the input terminal of getQuote : DynamicStockQuoteServicePortTypePartner

    Next, configure the properties of the primitives:

  4. Add the business object SubscriptionInformation to the correlation context of the input node. This business object will be used to carry subscription information from one primitive to another in the flow. Click getQuote : StockQuoteService and click the Details tab in the Properties view. In the Correlation context field, click Browse. Select SubscriptionInformation under matching data types, and click OK. .

    {http://Resources}SubscriptionInformation now appears in the Correlation context.


    Correlation Context added to Input node

  5. Click CustomerLookup in the request flow canvas, and enter these property values in the Details tab:
    Table 1. Database Lookup properties
    Property Value
    Data source name jdbc/sample/CustomerDatabase
    Table name CUSTOMERTABLE
    Key column name CUSTOMERID
    Key path Custom XPath. In the XPath Expression Builder, select /body/getQuote/request/customerID. Click OK
    XPath expression in the Expression Builder

    In the Data elements table, click Add and enter the following values:

    Table 2. Data elements table properties
    Column Value
    Value column name SUBSCRIPTIONLEVEL
    Message value type String
    Message element /context/correlation/subscriptionLevel

    Leave Validate input unchecked.


    Database Lookup details
  6. Click ServiceAddressLookup in the request flow canvas, and enter these property values in the Details tab:
    Table 3. Database Lookup properties
    Property Value
    Data source name jdbc/sample/CustomerDatabase
    Table name ENDPOINTTABLE
    Key column name SUBSCRIPTIONLEVEL
    Key path Custom XPath. In the XPath Expression Editor, select /context/correlation/subscriptionLevel. Click OK

    In the Data elements table, click Add and enter the following values:

    Table 4. Data elements table properties
    Column Value
    Value column name ADDRESS
    Message value type String
    Message element /headers/SMOHeader/Target/Address
    Target address in XPath Expression Builder

    Leave Validate input unchecked.

  7. Click Log in the request flow canvas to see the primitive's properties in the Properties view. Click the Details tab to view the properties. Use the default database to log the message. Enter these properties:
    Table 5. Message Logger properties
    Property Value
    Data source name jdbc/mediation/messageLog
    Root /
    Transaction mode Same
  8. Set the properties for the XSL Transformation primitive InterfaceTransformation:
    1. Select the InterfaceTransformation primitive in the request flow canvas. Switch to the Details tab in the Properties view.
    2. Click the New button next to the Mapping File field. The Specify Message Types wizard opens. This wizard shows the root, input and output message types that will be mapped. Click Finish. This action launches the mapping editor.
    3. In the Source section of the mapping editor, expand body > getQuote > request. In the Target section, expand body. Click symbol [0..1] in the Source, then click symbol in the Target. Right-click, and select Create Mapping.
      Mapping Editor
    4. Save your changes and close the mapping editor. The mapping file and associated XSL style sheet are displayed in the Details tab of the Properties view.
  9. Click getQuote : DynamicStockQuoteServicePortTypePartner, and view the details page in the properties view. Make sure that Use dynamic endpoint ... is checked.
    Details properties of the callout node
    .

    Save your changes. The request flow is now complete. Proceed to building the response flow.

Feedback
(C) Copyright IBM Corporation 2005, 2006. All Rights Reserved.
< Previous | Next >