views:

188

answers:

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 
+3  A: 

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

Mirko Nasato
Perfect! Thank you very much!
DroidIn.net