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

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

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

Code Block
<definitions xmlns="">
    <proxy name="StockQuoteProxy" transports="https">
                <address uri="http://localhost:9000/services/SimpleStockQuoteService" format="pox"/>
        <publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/>
  • Start the Synapse configuration numbered 152: i.e. -sn 152
  • 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.

Code Block
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.

Code Block
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">
Code Block
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>

Examples connected with proxy services.