hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ashish Kulkarni" <ashish.kulkarn...@gmail.com>
Subject Re: Basic Authentication Issue
Date Tue, 20 May 2008 15:12:37 GMT
Hi
This is the error i am getting

2008-05-20 11:08:33,437 DEBUG [main] params.DefaultHttpParams
(DefaultHttpParams.java:151) - Set parameter http.auth.scheme-priority =
[Basic]
2008-05-20 11:08:33,437 DEBUG [main] params.DefaultHttpParams
(DefaultHttpParams.java:151) - Set parameter http.method.retry-handler =
org.apache.commons.httpclient.DefaultHttpMethodRetryHandler@aa37a6
2008-05-20 11:08:33,437 DEBUG [main] httpclient.HttpConnection
(HttpConnection.java:692) - Open connection to uskzoas163:80
2008-05-20 11:08:33,487 DEBUG [main] httpclient.HttpMethodBase
(HttpMethodBase.java:1352) - Adding Host request header
2008-05-20 11:08:33,557 DEBUG [main] httpclient.HttpMethodDirector
(HttpMethodDirector.java:843) - Authorization required
2008-05-20 11:08:33,557 DEBUG [main] auth.AuthChallengeProcessor
(AuthChallengeProcessor.java:90) - Supported authentication schemes in the
order of preference: [Basic]
2008-05-20 11:08:33,557 DEBUG [main] auth.AuthChallengeProcessor
(AuthChallengeProcessor.java:111) - Challenge for Basic authentication
scheme not available
2008-05-20 11:08:33,557 WARN [main] httpclient.HttpMethodDirector
(HttpMethodDirector.java:697) - Unable to respond to any of these
challenges: {ntlm=NTLM}


On 5/20/08, Ashish Kulkarni <ashish.kulkarni13@gmail.com> wrote:
>
> Hi
> I have PDF file to download from a server which has basic authentication,
> I have the following code, but it gives 401 error, but if i take the same
> url in a browser and then enter user id, password in the popup box it works,
> so what may be the issue
>
> HttpClient client = new HttpClient();
>
> client.getState().setCredentials(
> new AuthScope("http://uskzoas163/MpssDocDisplay/", 80),
> new UsernamePasswordCredentials(userId, password)
> );
>
> GetMethod method = new GetMethod("
> http://uskzoas163/MpssDocDisplay/ALTERNATE/PMS-PAD/V_1/00-625080-000_PMS.pdf
> ");
> method.setDoAuthentication( true );
> method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
> new DefaultHttpMethodRetryHandler(3, false));
>
> int statusCode = client.executeMethod(method);
>
> status i get is 401, not authorised,
> Ashish
>
>
>

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