Message format transformations with WSO2 ESB

With WSO2 ESB, you can easily convert the format of the messages which passes through. There are situations in which you get SOAP requests but the back end server accepts XML. In these situations, you should convert the SOAP request to XML (POX) before forwarding to the endpoint. This post explains how you can change the format of a SOAP request goes through WSO2 ESB.

Download and install WSO2 ESB-3.X

Step 1
I use WSO2 WSAS as the backend, but you could use any server as you preferred. Start WSO2 WSAS and deploy Axis2Service

Step 2
Start WSO2 ESB and add the following configuration. Here, we specify the message format as POX in the endpoint configuration since we need to convert SOAP message to XML when forwarding it to the endpoint.

<sequence xmlns="" name="main">
<endpoint name="axis2service-epr">
<address uri="http://localhost:9763/services/Axis2Service" format="pox" />
<send />

Step 3
Send a SOAP1.1 message using a tool (SOAPUI, Jmeter, AB etc). If you look at the message transmission between ESB and the endpoint, you will notice the following messages

Request SOAP message:

SOAPAction: urn:echoString
Content-Length: 307
Content-Type: text/xml; charset=UTF-8
Connection: Keep-Alive
User-Agent: Jakarta-HttpComponents-Bench/1.1

<soapenv:Envelope xmlns:soapenv="" xmlns:ser="">
</soapenv:Body> </soapenv:Envelope>

Message delivered to the endpoint:

POST /services/Axis2Service HTTP/1.1
Content-Type: application/xml; charset=UTF-8
SOAPAction: urn:echoString
Transfer-Encoding: chunked
Connection: Keep-Alive
User-Agent: Synapse-HttpComponents-NIO

<ser:echoString xmlns:ser="">
<ser:s>test</ser:s> </ser:echoString>0

Similarly, you can convert the message to SOAP1.2 or HTTP GET just by specifying the endpoint format.


Popular posts from this blog

Common mistakes to avoid in WSO2 ESB - 1 - "org.apache.axis2.AxisFault: The system cannot infer the transport information from the URL"

Working with HTTP multipart requests in soapUI

How to configure soapUI to send HTTP chunked encoded requests