This sample demonstrates how a proxy service can be exposed on a subset of available transports and how it could switch from one transport to another.
For a list of prerequisites, see Prerequisites to Start the ESB Samples.
Building the sample
The XML configuration for this sample is as follows:
This configuration file
synapse_sample_152.xml is available in the
To build the sample
Start the ESB with the sample 152 configuration.
In order to run this sample, you need to manually replace the content in
<ESB_HOME>/repository/samples/synapse_sample_152.xmlwith the XML configuration given above.This needs to be done due to a known issue in the configuration file
<ESB_HOME>/repository/samples/synapse_sample_152.xml, which will be fixed in version 4.9.0.
For instructions on starting a sample ESB configuration, see Starting the ESB with a sample configuration.
The operation log keeps running until the server starts, which usually takes several seconds. Wait until the server has fully booted up and displays a message similar to "WSO2 Carbon started in n seconds."
Start the Axis2 server. For instructions on starting the Axis2 server, see Starting the Axis2 server.
Deploy the back-end service SimpleStockQuoteService. For instructions on deploying sample back-end services, see Deploying sample back-end services.
Executing the sample
The sample client used here is the Stock Quote Client, which can operate in several modes. For further details on this sample client and its operation modes, see Stock Quote Client.
To execute the sample client
Run the following command from the
Analyzing the output
This example exposes the created proxy service only on HTTPS. Therefore, if you try to access it over HTTP, it would result in a fault.
Accessing this over HTTPS using the command
ant stock quote -Dtrpurl= href="https://localhost:8243/services/StockQuoteProxy">https://localhost:8243/services/StockQuoteProxy causes the proxy service to access the
SimpleStockQuoteService on the sample Axis2 server using REST/POX.
If you capture the message exchange using TCPMon, you will see that the REST/POX response is transformed back into a SOAP message and returned to the client as follows: