This documentation is for WSO2 Enterprise Service Bus version 4.8.1 . View documentation for the latest release.

All docs This doc
Skip to end of metadata
Go to start of metadata

Objective: Demonstrate the Message Relay.

This sample is similar to sample 150 except we have added two log mediators to show the actual message going through the ESB.

<?xml version="1.0"?>
<definitions xmlns="">
    <proxy name="StockQuoteProxy" startOnLoad="true">
                <log level="full"/>
                    <endpoint name="epr">
                        <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
                <log level="full"/>
        <publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/>
    <sequence name="fault">
        <log level="full">
            <property name="MESSAGE" value="Executing default &quot;fault&quot; sequence"/>
            <property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/>
            <property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/>
    <sequence name="main">

Prerequisites: Deploy the SimpleStockQuoteService in sample Axis2 server and start it on port 9000. Then uncomment the Message Relay's Message Builder and Message Formatter in the axis2.xml. These configurations can be found in the messageFormatters and messageBuilders section of the axis2.xml. A message formatter or builder is defined for a content type. So make sure you comment out the normla builders and formatters for a content type when uncomenting the message relay builders and formatters.

Here are the Message Relay Formatter and Builder classes. You need to uncomment the entries containing the following builder and formatter.



Send a message to the sample using the sample axis2 client.

ant stockquote -Daddurl=http://localhost:8280/services/StockQuoteProxy

You can see the messages going through the proxy by looking at the console because we have two log mediators in this sample. The actual message is not built and printed as a Base64 encoded string.

  • No labels