|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
status code 401 authorization failed with NTLMHi,
I am using httpd client of version 3.1. and running my application on windows vista. we have share point portal site (which is *intranet*) which takes default my windows logon credentials when i access this site from the browser. I am trying to acces the same site from my java application using http client and passing same credentials. But it always fails with "401" error. Here is error I browsed the net, but i found the same code what i am using *Sep 18, 2009 6:14:32 PM org.apache.commons.httpclient.auth.AuthChallengeProcessor selectAuthScheme INFO: ntlm authentication scheme selected Status 401 Sep 18, 2009 6:14:33 PM org.apache.commons.httpclient.HttpMethodDirector processWWWAuthChallenge INFO: Failure authenticating with NTLM <any realm>@sharepoint.teams.com:80<http://sharepoint.teams.com/> * Here is my test code String url="http://sharepoint.teams.com/test/index.aspx"; HttpClient httpclient = new HttpClient(); httpclient .getParams().setAuthenticationPreemptive(true); NTCredentials defaultcreds = new NTCredentials("username","password","","myusernamedomain"); httpclient .getState().setCredentials(AuthScope.ANY,defaultcreds); GetMethod get = new GetMethod(url); int status = httpclient .executeMethod(get); System.out.println("status"+status); I have changed parameters for NTCredentials as usually i access the site by entering mydomail\username . so changed to NTCredentials defaultcreds = new NTCredentials("myusernamedomain\username","password","","""); But same error and also passed hostname NTCredentials defaultcreds = new NTCredentials("myusernamedomain\username","password","sharepoint.teams.com ","""); I have tried all the combinations, but no success. Is there anything else i am missing. What could be problem. Please help me, really i am stuck here. Thanks in advance Virg |
|
|
Re: status code 401 authorization failed with NTLMOn Fri, 2009-09-18 at 18:36 +0530, virg g wrote:
> Hi, > I am using httpd client of version 3.1. and running my application on > windows vista. we have share point portal site (which is *intranet*) which > takes default my windows logon credentials when i access this site from the > browser. I am trying to acces the same site from my java application using > http client and passing same credentials. But it always fails with "401" > error. Here is error > I browsed the net, but i found the same code what i am using > > *Sep 18, 2009 6:14:32 PM > org.apache.commons.httpclient.auth.AuthChallengeProcessor selectAuthScheme > INFO: ntlm authentication scheme selected > Status 401 > Sep 18, 2009 6:14:33 PM org.apache.commons.httpclient.HttpMethodDirector > processWWWAuthChallenge > INFO: Failure authenticating with NTLM <any > realm>@sharepoint.teams.com:80<http://sharepoint.teams.com/> > * > > Here is my test code > > String url="http://sharepoint.teams.com/test/index.aspx"; > HttpClient httpclient = new HttpClient(); > httpclient .getParams().setAuthenticationPreemptive(true); > > NTCredentials defaultcreds = new > NTCredentials("username","password","","myusernamedomain"); > httpclient .getState().setCredentials(AuthScope.ANY,defaultcreds); > GetMethod get = new GetMethod(url); > int status = httpclient .executeMethod(get); > System.out.println("status"+status); > > I have changed parameters for NTCredentials as usually i access the site by > entering mydomail\username . so changed to > NTCredentials defaultcreds = new > NTCredentials("myusernamedomain\username","password","","""); > But same error and also passed hostname > NTCredentials defaultcreds = new > NTCredentials("myusernamedomain\username","password","sharepoint.teams.com > ","""); > I have tried all the combinations, but no success. > > Is there anything else i am missing. What could be problem. Please help me, > really i am stuck here. > > Thanks in advance > Virg Upgrade to HttpClient 4.0 and follow the instructions of this guide: http://hc.apache.org/httpcomponents-client/ntlm.html Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscribe@... For additional commands, e-mail: httpclient-users-help@... |
| Free embeddable forum powered by Nabble | Forum Help |