1

I'm using HttpClient 4.0 to get some XML from the remote host. When I use URL such as https://user:[email protected] it works fine in the browser but fails in the HttpClient with this stacktrace (follows). Any suggestions? I'm using SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER while setting ThreadSafeClientConnManager to handle HTTPS requests

The code (partial):

final HttpGet get= new HttpGet(url);
final HttpResponse response = this.client.execute(get);
return new BasicResponseHandler().handleResponse(response);

Stacktrace:

01-05 22:34:03.783: ERROR/SearchResults(11565): 
    Failed to process request to URL: 
    https://user:[email protected]/products/foo/meta/xml_proper_encoding.jsp?version=1
01-05 22:34:03.783: ERROR/SearchResults(11565): 
    org.apache.http.client.HttpResponseException: Unauthorized 

1 Answer 1

4

Pass UsernamePasswordCredentials like in this example, not in the URL.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.