Demonstrate the ability of Synapse to perform transport switching (i.e. receiving messages over one transport and forwarding them over a different transport)
In this sample we are using a proxy service exposed over JMS (note the transports=jms attribute). If you check the WSDL of the proxy service using a web browser you will notice that it only has JMS endpoints.
Run the sample JMS client by switching to the samples/axis2Client directory and executing the following command.
This will send a plain XML formatted place order request to a JMS queue named 'StockQuoteProxy'. Synapse will be polling on this queue for any incoming messages so it will pick up the request. If you run Synapse in the DEBUG mode, following entry will be printed on the console.
Then Synapse will mediate the request through the service bus and forward it to the sample Axis2 server over HTTP. Axis2 server will print the following entry on the console when it receives the request.
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 also important to note that the name of the source JMS queue is same as the name of the proxy service (StockQuoteProxy). This is the default behavior of Synapse. Each proxy service by default listens on a JMS queue which has the same name as the service. 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 information. An example is given below.
With the above parameter in the proxy configuration, proxy service will listen on a JMS topic named 'something.TestTopic' for incoming requests.