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);

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



      
____________________________________________________________________________________
Catch up on fall's hot new shows on Yahoo! TV. Watch previews, get listings, 
and more!
http://tv.yahoo.com/collections/3658 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to