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 DJP JEAN-PROST Dominique <Do...@dexia-sofaxis.com> on 2009/12/23 08:49:06 UTC

No CredentialProviders problem in axis2 and httpclient

Hello,



[ENV]

AXIS2 1.5.1

Commons-httpclient 3.1

[/ENV]



I’m meeting a problem I really can’t resolve and after reading many lines of code in axis2, here where I am :

- I’m trying to call a ms exchange 2007 WS

- I setup I think my authentication code using this kind of code :



         final Options options = this.serviceExchange._getServiceClient().getOptions();

         final Authenticator authenticator = new Authenticator();



         // Cf. http://ws.apache.org/axis2/1_5_1/http-transport.html#preemptive_auth

         final List<String> authScheme = new ArrayList<String>();

         authScheme.add(Authenticator.NTLM);

         authScheme.add(Authenticator.BASIC);



         authenticator.setAuthSchemes(authScheme);

         authenticator.setUsername(this.username);

         authenticator.setPassword(this.password);

         authenticator.setHost(this.host);

         authenticator.setDomain(this.domain);

         authenticator.setPort(this.port);



         options.setTimeOutInMilliSeconds(this.timeout);

         options.setProperty(HTTPConstants.CHUNKED, "false");

         options.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, "true");

         options.setProperty(HTTPConstants.AUTHENTICATE, authenticator);



         this.serviceExchange._getServiceClient().setOptions(options);



I then get the following execution logs where you can see that there is no credential providers found.

So I searched the net, and found this http://markmail.org/search/list:org%2Eapache%2Ews%2Eaxis-dev+CredentialsProvider where you can see that the credential providers was first added and the deleted in org/apache/axis2/transport/http/AbstractHTTPSender.java





My question is then quite simple : how can I make this work ? Is it right that CredentialsProvider was deleted from AbstractHTTPSender ? If so, what should I add in my authentication setup to make it work ?

Regards,

dom









HttpMethodDirector.java:843)     - Authorization required

2009-12-21 12:01:11,447 DEBUG org.apache.commons.httpclient.HttpMethodDirector (       HttpMethodDirector.java:662)     - enter HttpMethodBase.processAuthenticationResponse(HttpState, HttpConnection)

2009-12-21 12:01:11,447 DEBUG org.apache.commons.httpclient.auth.AuthChallengeProcessor (   AuthChallengeProcessor.java:90)     - Supported authentication schemes in the order of preference: [NTLM, Basic]

2009-12-21 12:01:11,447 INFO  org.apache.commons.httpclient.auth.AuthChallengeProcessor (   AuthChallengeProcessor.java:101)     - NTLM authentication scheme selected

2009-12-21 12:01:11,463 DEBUG org.apache.commons.httpclient.auth.AuthChallengeProcessor (   AuthChallengeProcessor.java:155)     - Using authentication scheme: ntlm

2009-12-21 12:01:11,463 DEBUG org.apache.commons.httpclient.auth.AuthChallengeProcessor (   AuthChallengeProcessor.java:163)     - Authorization challenge processed

2009-12-21 12:01:11,463 DEBUG org.apache.commons.httpclient.HttpMethodDirector (       HttpMethodDirector.java:714)     - Authentication scope: NTLM <any realm>@mercure:443

2009-12-21 12:01:11,463 DEBUG org.apache.commons.httpclient.HttpState (                HttpState.java:436)     - enter HttpState.getCredentials(AuthScope)

2009-12-21 12:01:11,463 DEBUG org.apache.commons.httpclient.HttpMethodDirector (       HttpMethodDirector.java:861)     - Credentials required

2009-12-21 12:01:11,463 DEBUG org.apache.commons.httpclient.HttpMethodDirector (       HttpMethodDirector.java:879)     - Credentials provider not available

2009-12-21 12:01:11,463 INFO  org.apache.commons.httpclient.HttpMethodDirector (       HttpMethodDirector.java:737)     - No credentials available for NTLM <any realm>@mercure:443

2009-12-21 12:01:11,463 DEBUG org.apache.axis2.transport.http.HTTPSender (               HTTPSender.java:278)     - Handling response - 401



Consultez nos nouveaux sites internet : 
http://www.dexia-sofaxis.com 
http://www.dexia-sofcap-sofcah.com

Tous ensemble pour l’environnement : n’imprimer ce courriel que si nécessaire.

Dexia Sofaxis disclaimer : http://www.dexia-sofaxis.com/disclaimer.html

Re: No CredentialProviders problem in axis2 and httpclient

Posted by Amila Suriarachchi <am...@gmail.com>.
I tried with the sample described here[1] and it worked. this may help you.

Amila.

[1] http://amilachinthaka.blogspot.com/2010/01/axis2-authentication.html

On Wed, Dec 23, 2009 at 1:19 PM, DJP JEAN-PROST Dominique <
Dominique.JEAN-PROST@dexia-sofaxis.com> wrote:

>  Hello,
>
>
>
> [ENV]
>
> AXIS2 1.5.1
>
> Commons-httpclient 3.1
>
> [/ENV]
>
>
>
> I’m meeting a problem I really can’t resolve and after reading many lines
> of code in axis2, here where I am :
>
> - I’m trying to call a ms exchange 2007 WS
>
> - I setup I think my authentication code using this kind of code :
>
>
>
>          final Options options =
> this.serviceExchange._getServiceClient().getOptions();
>
>          final Authenticator authenticator = new Authenticator();
>
>
>
>          // Cf.
> http://ws.apache.org/axis2/1_5_1/http-transport.html#preemptive_auth
>
>          final List<String> authScheme = new ArrayList<String>();
>
>          authScheme.add(Authenticator.NTLM);
>
>          authScheme.add(Authenticator.BASIC);
>
>
>
>          authenticator.setAuthSchemes(authScheme);
>
>          authenticator.setUsername(this.username);
>
>          authenticator.setPassword(this.password);
>
>          authenticator.setHost(this.host);
>
>          authenticator.setDomain(this.domain);
>
>          authenticator.setPort(this.port);
>
>
>
>          options.setTimeOutInMilliSeconds(this.timeout);
>
>          options.setProperty(HTTPConstants.CHUNKED, "false");
>
>          options.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, "true");
>
>          options.setProperty(HTTPConstants.AUTHENTICATE, authenticator);
>
>
>
>          this.serviceExchange._getServiceClient().setOptions(options);
>
>
>
> I then get the following execution logs where you can see that there is no
> credential providers found.
>
> So I searched the net, and found this
> http://markmail.org/search/list:org%2Eapache%2Ews%2Eaxis-dev+CredentialsProviderwhere you can see that the credential providers was first added and the
> deleted in org/apache/axis2/transport/http/AbstractHTTPSender.java
>
>
>
>
>
> My question is then quite simple : how can I make this work ? Is it right
> that CredentialsProvider was deleted from AbstractHTTPSender ? If so, what
> should I add in my authentication setup to make it work ?
>
> Regards,
>
> dom
>
>
>
>
>
>
>
>
>
> HttpMethodDirector.java:843)     - Authorization required
>
> 2009-12-21 12:01:11,447 DEBUG
> org.apache.commons.httpclient.HttpMethodDirector (
> HttpMethodDirector.java:662)     - enter
> HttpMethodBase.processAuthenticationResponse(HttpState, HttpConnection)
>
> 2009-12-21 12:01:11,447 DEBUG
> org.apache.commons.httpclient.auth.AuthChallengeProcessor (
> AuthChallengeProcessor.java:90)     - Supported authentication schemes in
> the order of preference: [NTLM, Basic]
>
> 2009-12-21 12:01:11,447 INFO
> org.apache.commons.httpclient.auth.AuthChallengeProcessor (
> AuthChallengeProcessor.java:101)     - NTLM authentication scheme selected
>
> 2009-12-21 12:01:11,463 DEBUG
> org.apache.commons.httpclient.auth.AuthChallengeProcessor (
> AuthChallengeProcessor.java:155)     - Using authentication scheme: ntlm
>
> 2009-12-21 12:01:11,463 DEBUG
> org.apache.commons.httpclient.auth.AuthChallengeProcessor (
> AuthChallengeProcessor.java:163)     - Authorization challenge processed
>
> 2009-12-21 12:01:11,463 DEBUG
> org.apache.commons.httpclient.HttpMethodDirector (
> HttpMethodDirector.java:714)     - Authentication scope: NTLM <any
> realm>@mercure:443
>
> 2009-12-21 12:01:11,463 DEBUG org.apache.commons.httpclient.HttpState (
>                HttpState.java:436)     - enter
> HttpState.getCredentials(AuthScope)
>
> 2009-12-21 12:01:11,463 DEBUG
> org.apache.commons.httpclient.HttpMethodDirector (
> HttpMethodDirector.java:861)     - Credentials required
>
> 2009-12-21 12:01:11,463 DEBUG
> org.apache.commons.httpclient.HttpMethodDirector (
> HttpMethodDirector.java:879)     - Credentials provider not available
>
> 2009-12-21 12:01:11,463 INFO
> org.apache.commons.httpclient.HttpMethodDirector (
> HttpMethodDirector.java:737)     - No credentials available for NTLM <any
> realm>@mercure:443
>
> 2009-12-21 12:01:11,463 DEBUG org.apache.axis2.transport.http.HTTPSender
> (               HTTPSender.java:278)     - Handling response - 401
>
>
>
>
>
>
>
> Consultez nos nouveaux sites internet : http://www.dexia-sofaxis.com http://www.dexia-sofcap-sofcah.com
>
> Tous ensemble pour l’environnement : n’imprimer ce courriel que si nécessaire.
>
> Dexia Sofaxis disclaimer : http://www.dexia-sofaxis.com/disclaimer.html
>
>


-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/