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

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

Objective: Switching transports and message format from SOAP to REST/POX.

<definitions xmlns="">
    <proxy name="StockQuoteProxy" transports="https">
                <address uri="http://localhost:9000/services/SimpleStockQuoteService" format="pox"/>
                <property name="messageType" value="text/xml" scope="axis2"/>
        <publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/>
  • Start the Synapse configuration numbered 152: i.e. -sn 152


    In order to run this sample, you need to manually replace the content in <ESB_HOME>/repository/samples/synapse_sample_152.xml with 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.
  • Start the Axis2 server and deploy the SimpleStockQuoteService if not already done.

This configuration demonstrates how a Proxy Service could be exposed on a subset of available transports and how it could switch from one transport to another. This example exposes the created Proxy Service only on HTTPS, and thus if the user tries to access it over HTTP, would result in a fault.

ant stockquote -Dtrpurl=http://localhost:8280/services/StockQuoteProxy
     [java] org.apache.axis2.AxisFault: The service cannot be found for the endpoint reference (EPR) /services/StockQuoteProxy

Accessing this over HTTPS (ant stockquote -Dtrpurl= https://localhost:8243/services/StockQuoteProxy) causes the Proxy Service to access the SimpleStockQuoteService on the sample Axis2 server using REST/POX. This could be seen if the message exchange was captured using TCPMon as follows. The REST/POX response is now transformed back into a SOAP message and returned to the client.

POST http://localhost:9000/services/SimpleStockQuoteService HTTP/1.1
SOAPAction: urn:getQuote
Content-Type: application/xml; charset=UTF-8;action="urn:getQuote";
Transfer-Encoding: chunked
Connection: Keep-Alive
User-Agent: Synapse-HttpComponents-NIO

<m0:getQuote xmlns:m0="http://services.samples/xsd">
HTTP/1.1 200 OK
Content-Type: application/xml; charset=UTF-8;action="http://services.samples/SimpleStockQuoteServicePortType/getQuoteResponse";
Date: Tue, 24 Apr 2007 14:42:11 GMT
Server: Synapse-HttpComponents-NIO
Transfer-Encoding: chunked
Connection: Keep-Alive

<ns:getQuoteResponse xmlns:ns="http://services.samples/xsd">
      <ns:lastTradeTimestamp>Tue Apr 24 20:42:11 LKT 2007</ns:lastTradeTimestamp>
      <ns:name>IBM Company</ns:name>
  • No labels