...
We created our own handler which is derived from the
org.apache.axis.transport.http.HttpSender.
In this handler we implemented the following:
We overwrote the method invoke and called the handleRequest-Method.
We registered the handler by changing the client-config.wsdd:
from
to
In the stub of the application we set the required header by using the
setProperty of the call-Object.
call.setProperty("PROP_KEY", "some value");
this is the derived handler:
public class MyHTTPHandler extends HTTPSender
{
public void invoke(MessageContext msgContext) throws AxisFault {
handleRequest(msgContext);
super.invoke(msgContext);
}
public boolean handleRequest( MessageContext context )
{
Hashtable headers = ( Hashtable )
context.getProperty( HTTPConstants.REQUEST_HEADERS );
if ( headers == null )
{
headers = new Hashtable();
context.setProperty( HTTPConstants.REQUEST_HEADERS, headers );
}
String value = (String ) context.getProperty( "PROP_KEY" );
headers.put( "MyHeader", value );
return true;
}
}
Other solution is to setProperty, in the org.apache.axis.client.Call object, a Hashtable with all the key->value mapped to org.apache.axis.transport.http.HTTPConstants.REQUEST_HEADERS
ReplyDelete