WSO2 ESB - Header Mediator

Header Mediator

The header mediator sets or removes a specified header from the current soap info-set. At the moment set header only supports simple valued headers.

Syntax

 <header name="qname" (value="literal" | expression="xpath") [action="set"]/>
 <header name="qname" action="remove"/>

The optional action attribute specifies whether the mediator should set or remove the header. If omitted, it defaults to a set-header.

UI Configuration

Figure1: Header Mediator

Here are the option you have in configuring the header mediator.

Example

  <in>
      <RMSequence single="true" version="1.0"/>
      <send>
         <endpoint name="reliable">
            <address uri="http://localhost:9000/services/ReliableStockQuoteService">
               <enableRM/>
               <enableAddressing/>
            </address>
         </endpoint>
      </send>
  </in>
  <out>
      <header name="wsrm:SequenceAcknowledgement" action="remove"
              xmlns:wsrm="http://schemas.xmlsoap.org/ws/2005/02/rm"/>
      <header name="wsrm:Sequence" action="remove"
              xmlns:wsrm="http://schemas.xmlsoap.org/ws/2005/02/rm"/>
      <header name="wsrm:AckRequested" action="remove"
              xmlns:wsrm="http://schemas.xmlsoap.org/ws/2005/02/rm"/>
      <send/>
  </out>

ESB receives a non reliable message and it forward it to an endpoint that supports reliable messaging. In this example when ESB recieves a message we send it using Reliable messaging. So the response ESB receives is having Reliable messaging headers. We don't want to send these headers to the client who doesn't support reliable messaging. So we remove the reliable messaging headers before sending the reponse to the client.