To add an *HTTP* header you can do ...
Hashtable userHeaderTable =
(Hashtable) msgContext.getProperty(HTTPConstants.REQUEST_HEADERS);
if (userHeaderTable == null)
{
userHeaderTable = new Hashtable();
msgContext.setProperty(HTTPConstants.REQUEST_HEADERS, userHeaderTable);
}
userHeaderTable.put("name", "value");
... where msgContext is the Axis MessageContext. This hashtable is then used
by Axis' CommonsHTTPSender or HTTPSender to add the headers to the HTTP
request. There are various ways to get a handle to the MessageContext. I
have my own Axis Handler and so get the MessageContext from
Handler.invoke(MessageContext).
-----Original Message-----
From: Ness, Raymond [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 20, 2005 2:37 PM
To: [email protected]
Subject: RE: setting HTTP headers in Axis Stub
myStub.setHeader(LocHeader("ns0","AUser","bogus"));
private static SOAPHeaderElement LocHeader(String PrefixString, String
UserNameString, String PasswordString){
String errorString = "SOAPHeaderElementError: ";
SOAPHeaderElement locSOAPHeaderElement =new
SOAPHeaderElement("http://somewhere.com/namespaces/1.0","Localization");
try{
SOAPElement local =
locSOAPHeaderElement.addChildElement("Locale","");
local.addTextNode("Eng");
SOAPElement timezone =
locSOAPHeaderElement.addChildElement("Timezone","");
timezone.addTextNode("Pacific");
}catch(Exception e){
System.out.println(errorString + "\nExecution
failed. Exception: " + e.toString());
}
return locSOAPHeaderElement;
}
-----Original Message-----
From: Robert Dietrick [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 19, 2005 12:25 PM
To: [email protected]
Subject: setting HTTP headers in Axis Stub
I'm using a ServiceLocator to get an instance of my Stub class capable
of interacting with my remote service. That is,
MyServiceIF client = MyServiceServiceLocator.getMyService(serviceUrl);
Then I use the client object (a subclass of org.apache.axis.client.Stub)
to make calls to my service. I.e.,
client.someRemoteMethod(someArg);
I'd like to be able to pass custom HTTP headers in my calls, but I can't
find any API calls that would grant me access to the transport layer.
Does anyone know if that's possible?
Thanks.
-rob