Kaliappan
Kaliappan

Reputation: 660

How to read http POST request payload data in WSO2 ESB

I am new to wso2 esb. I know how to read http url parameters. I have requirment that my proxy will receive http POST request with payload data in it. I want to know how to read that POST payload data in proxy.?

Upvotes: 1

Views: 2331

Answers (1)

Bee
Bee

Reputation: 12512

If you just want to do a REST to SOAP transformation you don't need to read the message body. Here is a sample Synapse configuration.

<api xmlns="http://ws.apache.org/ns/synapse" name="TestAPI" context="/test">
   <resource methods="POST GET">
      <inSequence>
         <property name="SOAPAction" value="" scope="transport"/>
         <send>
            <endpoint>
               <address uri="http://demo8290629.mockable.io/test" format="soap11"/>
            </endpoint>
         </send>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </resource>
</api>

You can call it like this.

curl -H "Content-Type:application/xml" -d '<ns:operationRequest xmlns:ns="http://demo8290629.mockable.io/service/1">testing</ns:operationRequest>' http://172.17.0.1:8280/test

However, if you want to read the message to a property, you can do it like this.

<property name="payload" expression="$body"/>

Upvotes: 2

Related Questions