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: Introduction to switching transports with proxy services. The JMS provider will be JBoss Messaging(JBM) (

<definitions xmlns="">
    <proxy name="StockQuoteProxy" transports="jms">
                <property action="set" name="OUT_ONLY" value="true"/>
                <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
        <publishWSDL uri="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"/>
        <parameter name="transport.jms.ContentType">


  • Start the Axis2 server and deploy the SimpleStockQuoteService (Refer steps above)
  • Download , install and start JBM server (, and configure Synapse to listen on JBM (refer notes below)

Start the ESB configuration numbered 263: i.e. wso2esb-samples -sn 263. We need to configure the required queues in JBM. Add the following entry to JBM jms configuration inside file-config/stand-alone/non-clustered/jbm-jms.xml.

<queue name="StockQuoteProxy">
    <entry name="StockQuoteProxy"/>

Once you started the JBM server with the above changes you'll be able to see the following on STDOUT.

10:18:02,673 INFO [org.jboss.messaging.core.server.impl.MessagingServerImpl] JBoss Messaging Server version 2.0.0.BETA3 (maggot, 104) started

You also need to copy the jbm-core-client.jar, jbm-jms-client.jar, jnp-client.jar(these jars are inside $JBOSS_MESSAGING/client folder) and jbm-transports.jar, netty.jar(these jars are from $JBOSS_MESSAGING/lib folder) jars from JBM into the $ESB_HOME/repository/components/lib directory. This was tested with JBM 2.0.0.BETA3

You need to add the following configuration for Axis2 JMS transport listener in axis2.xml found at repository/conf/axis2.xml.

<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
    <parameter name="default" locked="false">
        <parameter name="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</parameter>
        <parameter name="java.naming.provider.url">jnp://localhost:1099</parameter>
        <parameter name="java.naming.factory.url.pkgs">org.jboss.naming:org.jnp.interfaces</parameter>
        <parameter name="transport.jms.ConnectionFactoryJNDIName">ConnectionFactory</parameter>

Once you start ESB configuration 263 and request for the WSDL of the proxy service (http://localhost:8280/services/StockQuoteProxy?wsdl) you will notice that its exposed only on the JMS transport. This is because the configuration specified this requirement in the proxy service definition.

Before running the JMS client you need to open the build.xml ant script and uncomment the following block under the jmsclient target.

<!--<sysproperty key="java.naming.provider.url" value="${java.naming.provider.url}"/> <sysproperty key="java.naming.factory.initial" value="${java.naming.factory.initial}"/> <sysproperty key="java.naming.factory.url.pkg" value="${java.naming.factory.url.pkg}"/>-->

Now lets send a stock quote request on JMS, using the dumb stock quote client as follows:

ant jmsclient -Djms_type=pox -Djms_dest=StockQuoteProxy -Djms_payload=MSFT -Djava.naming.provider.url=jnp://localhost:1099 -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory 


On the ESB debug(you'll need to enable debug log in ESB) log you will notice that the JMS listener received the request message as:

[JMSWorker-1] DEBUG ProxyServiceMessageReceiver -Proxy Service StockQuoteProxy received a new message...

Now if you examine the console running the sample Axis2 server, you will see a message indicating that the server has accepted an order as follows:

Accepted order for : 16517 stocks of MSFT at $ 169.14622538721846

In this sample, the client sends the request message to the proxy service exposed over JMS in Synsape. Synapse forwards this message to the HTTP EPR of the simple stock quote service hosted on the sample Axis2 server. Note that the operation is out-only and no response is sent back to the client. The transport.jms.ContentType property is necessary to allow the JMS transport to determine the content type of incoming messages. With the given configuration it will first try to read the content type from the 'contentType' message property and fall back to 'application/xml' (i.e. POX) if this property is not set. Note that the JMS client used in this example doesn't send any content type information.


It is possible to instruct a JMS proxy service to listen to an already existing destination without creating a new one. To do this, use the parameter elements on the proxy service definition to specify the destination and connection factory etc. For example:

<parameter name="transport.jms.Destination">dynamicTopics/something.TestTopic</parameter>
  • No labels