< Previous | Next >

Building the response flow

Build the response flow for the getQuote operation: create the mediation primitives, set their properties, and wire the flow.

Response flows are represented from left to right in the editor. On the left are the callout nodes, one for each target operation; this is where the returning message enters the response flow. On the right is an inputResponse node, which represents the message returning to the source operation. You will add mediation primitives between the nodes and wire the flow. The completed response flow is shown below:
Screenshot of StockQuote_MediationFlow component's response flow

To build the response flow, complete the following steps:

  1. Click the Response tab to view the response flow.
  2. Select an XSL Transformation primitive from the palette, drop it onto the response flow canvas, and rename it DelayedToStockQuoteService.
  3. Select another XSL Transformation primitive from the palette, drop it onto the response flow canvas, and rename it RealtimeToStockQuoteService.
  4. Select a Message Element Setter primitive from the palette, drop it onto the canvas, and rename it SetQualityOfService.
  5. Select a Fail primitive from the palette, drop it onto the canvas and rename it DelayedStockQuoteFail. Add another Fail primitive to the canvas and rename it RealtimeStockQuoteFail.
  6. Wire the primitives:
    • The output terminal of getQuote : DelayedServicePortTypePartner to the input terminal of DelayedToStockQuoteService
    • The output terminal of getQuote : RealtimeServicePortTypePartner to the input terminal of RealtimeToStockQuoteService
    • The output terminal of DelayedToStockQuoteService to the input terminal of SetQualityOfService
    • The output terminal of RealtimeToStockQuoteService to the input terminal of SetQualityOfService
    • The output terminal of SetQualityOfService to the input terminal of getQuote : StockQuoteService
    • The fail terminal of getQuote : DelayedServicePortTypePartner to the input terminal of DelayedStockQuoteFail
    • The fail terminal of getQuote : RealtimeServicePortTypePartner to the input terminal of RealtimeStockQuoteFail
  7. Set the properties for the XSLT primitive DelayedToStockQuoteService:
    1. Select the DelayedToStockQuoteService primitive in the response flow canvas and double-click it.
    2. The New XML Mapping wizard opens. Click Next to see the root, input, and output message types that will be mapped. Accept the defaults and click Finish.
    3. In the input object section (left side) of the mapping editor, expand body. In the output object section (right side), expand body > getQuoteResponse > response.
    4. Click value on the left side and drag it to value on the right side to wire them and create the mapping.
    5. Save your changes and close the mapping editor.
      Screenshot of StockQuote_MediationFlow component's response flow
      The mapping file is displayed in the Details tab of the Properties view. DelayedToStockQuoteService details
  8. Similarly, set the properties for the XSLT primitive RealtimeToStockQuoteService:
    1. Select the RealtimeToStockQuoteService primitive in the response flow canvas and double-click it.
    2. The New XML Mapping wizard opens. Click Next to see the root, input, and output message types that will be mapped. Accept the defaults and click Finish.
    3. In the input object section (left side) of the mapping editor, expand body. In the output object section (right side), expand body > getQuoteResponse > response.
    4. Click value on the left side and drag it to value on the right side to wire them and create the mapping.
    5. 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. Set the properties for the Message Element Setter primitive SetQualityOfService:
    1. Select the SetQualityOfService primitive in the response flow canvas. Switch to the Details tab in the Properties view.
    2. Click Add... to start the Add/Edit Properties wizard.
    3. From the Action dropdown select Copy. For Target select Browse, which will bring up the XPath Expression Builder.
    4. In the Data Types Viewer, expand ServiceMessageObject > body > getQuoteResponse > response : StockQuoteResponse. Select qualityOfService and drag it to the XPath Expression field below. Click Finish.
    5. For the Source field select Browse. In the Data Types Viewer, expand ServiceMessageObject > context > correlation. Select subscriptionLevel and drag it to the XPath Expression field below. Click Finish.
    6. In the source field enter /context/correlation/subscriptionLevel.
      Message Element Setter Add/Edit Properties wizard
      The target, type and value columns of the table are populated in the first row as shown. To edit them later, select the row and click Edit...
      Message Element Setter Properties view
  10. For the two Fail primitives:
    1. Right click DelayedStockQuoteFail and select Show in Properties. Click Details and in the Error message field enter Failed to call DelayedStockQuoteService.
      Fail primitive details
    2. For RealtimeStockQuoteFail enter Failed to call RealtimeStockQuoteService in the Error message field.
  11. Save the flow by pressing Ctrl-S.

Feedback

(C) Copyright IBM Corporation 2005, 2008. All Rights Reserved.

< Previous | Next >