问题
I would like to transform the SOAP response body to JSON using WSO2 ESB 4.0.3. I found info on how to configure the ESB for JSON but then what?
To put it differently; I would like to have/create a transform mediator that transforms incoming SOAP/XML response into JSON (and actually it woudl be good to have a JSON2XML transform mediator too).
Should I develop is as a Groovy script mediator or Java class mediator? The best would be to have it pre-packaged with the ESB as it says it supports JSON and format transformations...
Thanks
回答1:
You can use a XSLT transform to do that. See this sample. It shows how to transform a JSON into a SOAP request and forward to the Axis2 server. Then the SOAP response from the Axis2 server will be converted into a JSON message and sent back. Before that, as you mentioned, you will have to configure ESB to support JSON like this.
来源:https://stackoverflow.com/questions/9311517/how-can-i-transform-an-incoming-soap-response-into-a-json-document-using-wso2-es