Thanks Giao. The key statement seems to be setPreemptiveAuthentication(true).
----- Original Message ---- From: Giao <[EMAIL PROTECTED]> To: [email protected] Sent: Thursday, October 11, 2007 12:43:58 PM Subject: Re: how to add basic auth header to soap request Forgot. You need Java 1.5 or higher. Try this. .... HttpTransportProperties.Authenticator basicAuth = new HttpTransportProperties.Authenticator(); List<String> auth = new ArrayList<String>(); basicAuth.setAuthSchemes(auth); auth.add(HttpTransportProperties.Authenticator.BASIC); basicAuth.setPreemptiveAuthentication(true); basicAuth.setUsername("USER"); basicAuth.setPassword("PASSWORD"); options.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, basicAuth); ... It works for me. Giao Nguyen --- Murali Krishnan <[EMAIL PROTECTED]> wrote: > Hi all, > I'm trying to add a Basic Auth header to the > outgoing soap request, but I'm not seeing it in the > list of headers. This is the code I'm using. Is > there something wrong? > > ServiceClient client = new ServiceClient(); > Options options = new Options(); > > HttpTransportProperties.Authenticator > basicAuth = new > HttpTransportProperties.Authenticator(); > basicAuth.setUsername("xxxxxxx"); > basicAuth.setPassword("xxxxxxx"); > > options.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, > basicAuth); > > options.setAction("urn:echo"); > options.setTo(new > EndpointReference(args[0])); > > client.setOptions(options); > > OMElement response = > client.sendReceive(getPayload("Dummy")); > > System.out.println(response); > > > Outgoing SOAP request: (captured with tcpmon) > ==================== > POST /web/wss11/services/Services_EchoWSD HTTP/1.1 > Content-Type: text/xml; charset=UTF-8 > SOAPAction: "urn:echo" > User-Agent: Axis2 > Host: 127.0.0.1:5050 > Transfer-Encoding: chunked > > f0 > <?xml version='1.0' encoding='UTF-8'?> > > <soapenv:Body> > > <input>Dummy</input> > </ns1:echo> > </soapenv:Body> > </soapenv:Envelope>0 > > > > > > ____________________________________________________________________________________ > Take the Internet to Go: Yahoo!Go puts the Internet > in your pocket: mail, news, photos & more. > http://mobile.yahoo.com/go?refer=1GNXIC ____________________________________________________________________________________ Be a better Globetrotter. Get better travel answers from someone who knows. Yahoo! Answers - Check it out. http://answers.yahoo.com/dir/?link=list&sid=396545469 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ____________________________________________________________________________________ Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase. http://farechase.yahoo.com/
