WSO2 ESB Removing full soap header using enrich mediator.

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:Envelope   xmlns:soap="">
  <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 envelop from the property.

            <source type="body" clone="true"/>
            <target type="property" property="ORIGINAL_BODY"/>

         <payloadFactory media-type="xml">
               <soapenv:Envelope xmlns:soapenv="">

            <source type="property" clone="true" property="ORIGINAL_BODY"/>
            <target type="body"/>


  1. Don't find fault, find a remedy. See the link below for more info.



Post a Comment

Popular posts from this blog

WSO2 ESB Script Mediator (Remove body of an soap envelop)

WSO2 ESB append full body to a POST parameter