Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You can add custom SOAP headers to a request by using the addHeader(mustUnderstand, content) of the Script Mediator in the proxy service as shown in the example below.

Code Block
languagexml
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="CustomSOAPHeaderProxy"
       startOnLoad="true"
       statistics="disable"
       trace="disable"
       transports="http,https">
   <target>
      <inSequence>
         <log level="full">
            <property name="Message" value="IncomingRequest"/>
         </log>
         <script language="js">mc.addHeader(false, &lt;ns:sampleCustomHeader xmlns:ns="gsb:http://wso2.org/sample"&gt;&lt;ns:customInfo&gt;CustomHeader&lt;/ns:customInfo&gt;&lt;/ns:sampleCustomHeader&gt;);</script>
         <log level="full">
            <property name="Message" value="UpdatedMessage"/>
         </log>
         <drop/>
      </inSequence>
   </target>
   <description/>
</proxy>