You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Derek Weeks <de...@gmail.com> on 2007/02/15 22:45:48 UTC

Web service client authentication

Hi Axis2 users,

I'm writing a web service client that needs to authenticate against
the HTTP server.

The example of how to do this in the Transports section of the
documentation says to add an HttpTransportProperties.Authenticator
object to the Options object using the key
org.apache.axis2.transport.http.HTTPConstants.BASIC_AUTHENTICATE.

This constant does not appear to exist in Axis2 version 1.1 or 1.1.1. Should the
constant be one of these?
HTTPConstants.AUTHENTICATE
HttpTransportProperties.Authenticator.BASIC

Cheers,

Derek

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Web service client authentication

Posted by Derek Weeks <de...@gmail.com>.
Thanks Jarek,

The key line I was missing was:
auth.setPreemptiveAuthentication(true);

It wasn't necessary for me to use auth.setAuthSchemes() because Axis
determined that it needed to use basic authentication on its own.

Thanks for your help,

Derek

On 16/02/07, Jarek Kucypera <jk...@mikrozet.wroc.pl> wrote:
> Derek Weeks wrote:
>
> > This constant does not appear to exist in Axis2 version 1.1 or 1.1.1.
> > Should the
> > constant be one of these?
>
> Following  is how it works for me with axis2 1.1.1
>
> HttpTransportProperties.Authenticator auth = new
> HttpTransportProperties.Authenticator();
> auth.setPreemptiveAuthentication(true);
> auth.setAuthSchemes(Arrays.asList(new
> String[]{HttpTransportProperties.Authenticator.BASIC}));
> auth.setUsername("test_user");
> auth.setPassword("test_password");
> stub._getServiceClient().getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE,auth);
>
> J.K.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Web service client authentication

Posted by Jarek Kucypera <jk...@mikrozet.wroc.pl>.
Derek Weeks wrote:

> This constant does not appear to exist in Axis2 version 1.1 or 1.1.1. 
> Should the
> constant be one of these?

Following  is how it works for me with axis2 1.1.1

HttpTransportProperties.Authenticator auth = new 
HttpTransportProperties.Authenticator();
auth.setPreemptiveAuthentication(true);
auth.setAuthSchemes(Arrays.asList(new 
String[]{HttpTransportProperties.Authenticator.BASIC}));
auth.setUsername("test_user");
auth.setPassword("test_password");
stub._getServiceClient().getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE,auth);

J.K.

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org