hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From virg g <06v...@gmail.com>
Subject status code 401 authorization failed with NTLM
Date Fri, 18 Sep 2009 13:06:15 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message