Reputation: 89
I am working on POC REST to SOAP call. I have rest client sending request into json format.My end point is in SOAP so how can i convert incoming json into soap without using java script.As in sample 271 WSO2ESB read csv file and auto convert it into desired SOAP. I need just like that. Please guide.
Upvotes: 0
Views: 672
Reputation: 31
The incoming JSON message is converted to the SOAP by the JSON message builder. The message builder is selected by the content-type of the incoming message. By default the relevant message formatter will select to format the message, here the JSON message formatter and output also the JSON message. So we need to explicitly select the formatter based on the required output. Hense need to select the SOAPMessageFormatter to send the SOAP output. You can add the following property configuration in axis2 level to select the SOAP formatter.
<property name="messageType" value="text/xml" scope="axis2"/>
Upvotes: 1
Reputation: 579
You can use the messageType property to change the message's content type as it flows through the ESB. For example, if the incoming message is in JSON format and you wanted to transform it to SOAP, you could add the messageType property before your mediators in the configuration.
Use the following property before sending out the message.
<property name="messageType" value="text/xml" scope="axis2"/>
So this property will use to invoke the following formatter.
<messageFormatter contentType="text/xml"
class="org.apache.axis2.transport.http.SOAPMessageFormatter"/>
You can get more idea on message builders and formatters on Working with Message Builders and Formatters
Upvotes: 0