Sample 50: POX to SOAP Conversion

<definitions xmlns=""> <sequence name="main"> <!-- filtering of messages with XPath and regex matches --> <filter source="get-property('To')" regex=".*/StockQuote.*"> <then> <send> <endpoint> <address uri="http://localhost:9000/services/SimpleStockQuoteService" format="soap11"/> </endpoint> </send> <drop/> </then> </filter> <send/> </sequence> </definitions>


Demonstrating how to convert a POX (Plain Old XML) message to a standard SOAP 1.1 request.


  • Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
  • Start Synapse using the configuration numbered 50 (repository/conf/sample/synapse_sample_50.xml)
    Unix/Linux: sh -sample 50
    Windows: synapse.bat -sample 50

Executing the Client

Execute the sample client as follows and send a plain XML getQuote request to Synapse.

ant stockquote -Dtrpurl=http://localhost:8280/services/StockQuote -Drest=true

The request sent by the client will look something like this.

POST /services/StockQuote HTTP/1.1 Content-Type: application/xml; charset=UTF-8;action="urn:getQuote"; SOAPAction: urn:getQuote User-Agent: Axis2 Host: Transfer-Encoding: chunked 75 <m0:getQuote xmlns:m0="http://services.samples"> <m0:request> <m0:symbol>IBM</m0:symbol> </m0:request> </m0:getQuote>0

Note that this is simply an XML payload going over the HTTP connection. It is not a SOAP envelope and hence the content type is set to application/xml. Synapse will convert the above message to a valid SOAP 1.1 request and send to the sample Axis2 server. The response from Axis2 will also be a SOAP message, which will be converted back to POX format before sending back to the client.

Back to Catalog