This documentation is for WSO2 Enterprise Integrator version 6.1.1 . View documentation for the latest release.

All docs This doc

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Table of Contents

Introduction

This Sample sample demonstrates how the PayloadFactory Mediator can be used to perform transformations as an alternative to the XSLT mediator, which is demonstrated in Sample 8: Introduction to Static and Dynamic Registry Resources and Using XSLT Transformations . In this sample, the ESB implements the message translator enterprise integration pattern, and acts as a translator between the client and the back-end server when mediating a message to the sample back-end server from a sample client.

...

For a list of prerequisites, see Prerequisites to Start see the prerequisites for starting the ESB Samples.

Building the sample

...

This configuration file  synapse_sample_17.xml is available in the <ESB<EI_HOME>/repositorysamples/samples service-bus directory.

To build the sample

...

  • Run the following command from the <ESB<EI_HOME>/samples/axis2Client directory.

    Code Block
    languagebash
    ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ -Dmode=customquote

Analyzing the output

When you analyze the debug log output on the ESB console, you will see that the incoming message is transformed by the PayloadFactory Mediator into a standard stock quote request as expected by the SimpleStockQuoteService deployed on the Axis2 server.

The printf() style formatting is used to configure the transformation performed by the mediator. Each argument in the mediator configuration can be a static value or an XPath expression.When  When an expression is used, the argument value is fetched at runtime by evaluating the provided XPath expression against the existing SOAP message.

The response from the SimpleStockQuoteService is converted back into the custom format as expected by the client during the out message processing, once again using the PayloadFactory Mediator.

...