// Set HTTP headers. // This does not work!!! String authorization = new sun.misc.BASE64Encoder().encode((username+":"+password).getBytes()); MimeHeaders hd = message.getMimeHeaders(); hd.addHeader("Authorization", "Basic " + authorization);
// Create and populate the body SOAPBody body = envelope.getBody();
There's currently a bug in Axis2 that prevents any SOAP headers from being transmitted. I'm trying to get the priority on that one raised, but have no word yet on when it might be fixed.
This means that SAAJ clients can't use HTTP authentication with the Axis2 libraries. The workarounds would be either to use the Axis1 libraries for the client, or to use a JAX-WS client. [ November 17, 2008: Message edited by: Ulf Dittmer ]