title: Adding custom HTTP headers to Axis 1.4 web service responses
body: <p>I'm trying to add custom HTTP headers to Axis 1.4 web servers.</p>
  
  <p>I've created a handler which extends BasicHandler:</p>
  
  <pre><code>public class HttpHeaderHandler extends BasicHandler {
  
    .
    .
    .
  
    @Override
    public void invoke(org.apache.axis.MessageContext arg0) throws AxisFault {  
      LOG.trace("invoke called");     
      Hashtable ht = (Hashtable)ctx.getProperty(HTTPConstants.RESPONSE_HEADERS);
      if(ht == null) {
        ht = new Hashtable();
      }
      ht.put("custom-header", "Hello");
      ctx.setProperty(HTTPConstants.RESPONSE_HEADERS, ht);     
    }
  
    .
    .
    .
  
  }
  </code></pre>
  
  <p>I've added the following to server-config.wsdd:</p>
  
  <pre><code>    .
      .
      .
  
  &lt;transport name="http"&gt;
      &lt;requestFlow&gt;
          &lt;handler type="URLMapper" /&gt;
          &lt;handler type="java:org.apache.axis.handlers.http.HTTPAuthHandler" /&gt;
      &lt;/requestFlow&gt;
      &lt;responseFlow&gt;
          &lt;handler type="java:com.my.package.HttpHeaderHandler" /&gt;
      &lt;/responseFlow&gt;
  &lt;/transport&gt;
  
      .
      .
      .
  </code></pre>
  
  <p>I can see that the invoke method is being called as the logging is appearing in the log file but the custom header is not being added to the response.</p>
  
  <p>Any suggestions appreciated.</p>