ws-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Ws Wiki] Update of "FrontPage/Axis/AxisClientSetHTTPHeaders" by FlorianKirchhoff
Date Wed, 15 Sep 2010 19:34:06 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Ws Wiki" for change notification.

The "FrontPage/Axis/AxisClientSetHTTPHeaders" page has been changed by FlorianKirchhoff.
http://wiki.apache.org/ws/FrontPage/Axis/AxisClientSetHTTPHeaders

--------------------------------------------------

New page:
Q: How do I setup HTTP headers in Axis clients?

A: Set the appropriate Hashtable entry in the MessageContext in a Handler:

{{{
package yourpackage;
import java.util.Hashtable;
import org.apache.axis.AxisFault;
import org.apache.axis.MessageContext;
import org.apache.axis.handlers.BasicHandler;
import org.apache.axis.transport.http.HTTPConstants;
public class HTTPHeaderHandler extends BasicHandler {
  @Override
  public void invoke(MessageContext ctx) throws AxisFault {
    Hashtable ht = (Hashtable)ctx.getProperty(HTTPConstants.REQUEST_HEADERS);
    if(ht == null) {
      ht = new Hashtable();
    }
    ht.put("test", "test");
    ctx.setProperty(HTTPConstants.REQUEST_HEADERS, ht);
  }
}
}}}
The next step is to configure the handler in client-config.wsdd:

{{{
<?xml version="1.0" encoding="UTF-8"?>
<deployment name="defaultClientConfig" xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<globalConfiguration>
  <parameter name="disablePrettyXML" value="true" />
  <parameter name="enableNamespacePrefixOptimization" value="false" />
 </globalConfiguration>
 <handler type="java:yourpackage.HTTPHeaderHandler" name="HTTPHeaderHandler" />
 <transport name="http"
  pivot="java:org.apache.axis.transport.http.HTTPSender">
  <requestFlow>
   <handler type="HTTPHeaderHandler" />
  </requestFlow>
 </transport>
 <transport name="local" pivot="java:org.apache.axis.transport.local.LocalSender" />
 <transport name="java"  pivot="java:org.apache.axis.transport.java.JavaSender" />
</deployment>
}}}
You can find details of how to configure a Handler in AxisClientConfiguration and how to ensure
your client code picks up your client-config.wsdd in AxisClientConfiguration.

Mime
View raw message