WSO2 ESB supports many mediators, and we can use them to achieve most of our use cases.
The following message template illustrates the structure of a SOAP Envelope:
<soap:Header> <!-- optional -->
<!-- header blocks go here... -->
<!-- payload or Fault element goes here... -->
Even though soap header is optional, you might receive the soap envelop with soap headers. And you might need to remove the soap header element including <soap:Header></soap:Header> element.
You can achieve this by using enrich mediator and payload factory mediator.
We first extract the body from the soap envelop and assign it to a property using enrich mediator. Then we create an empty soap envelop using payload factory. At last enrich mediator is again used to put the soap body to soap envelo…
When you have to invoke a back end service which can take only on parameter and you need to send your full soap envelop body as single post parameter you can use script mediator and payload factory mediator as following. I have an api which calls to "http://localhost:9000/services/SimpleStockQuoteService" and response is received by the "second_sequence".
In the second_sequence response is processed and assign it single parameter using script mediator and payload factory.
When you are implementing synapse configurations in WSO2 ESB (4.6.0), sometimes you might want to remove soap body. This happens to me when I was developing complex synapse configuration, which had lot of service chaining. The last of the service chaining was to call to a rest (GET) end point using rest api. Up to final call to rest api, everything seems to work perfect. But the last rest api call fails due to a soap envelop generated from service chaining. Simple solution was to remove the soap body from the envelop. then it worked perfectly as I expected.
This is the simple solution I used to remove the body from the soap envelop using script mediator.