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:
- 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.
- Click the source getQuote operation to view the request flow. Add
mediation primitives in sequence from left to right, as follows:
- Expand the first primitive in the palette, and add a DatabaseLookup
primitive onto the canvas, and rename it CustomerLookup.
- Add another DatabaseLookup primitive onto the canvas, and rename
it ServiceAddressLookup.
- Add a MessageLogger primitive onto the canvas. Rename Message
Logger to Log.
- Add an XSL Transformation primitive onto the canvas, and rename
it InterfaceTransformation.
- 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:
- 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.

- Click CustomerLookup in the request flow
canvas, and enter these property values in the Details tab:
Table 1. Database Lookup propertiesProperty |
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
 |
In the Data elements table, click Add and
enter the following values:
Table 2. Data elements table propertiesColumn |
Value |
Value column name |
SUBSCRIPTIONLEVEL |
Message value type |
String |
Message element |
/context/correlation/subscriptionLevel |
Leave Validate input unchecked.

- Click ServiceAddressLookup in the request
flow canvas, and enter these property values in the Details tab:
Table 3. Database Lookup propertiesProperty |
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 propertiesColumn |
Value |
Value column name |
ADDRESS |
Message value type |
String |
Message element |
/headers/SMOHeader/Target/Address

|
Leave Validate input unchecked.
- 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 propertiesProperty |
Value |
Data source name |
jdbc/mediation/messageLog |
Root |
/ |
Transaction mode |
Same |
- Set the properties for the XSL Transformation primitive InterfaceTransformation:
- Select the InterfaceTransformation primitive
in the request flow canvas. Switch to the Details tab
in the Properties view.
- 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.
- 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.

- 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.
- Click getQuote : DynamicStockQuoteServicePortTypePartner,
and view the details page in the properties view. Make sure that Use
dynamic endpoint ... is checked.

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