I am trying to get data from an exchange point server. Below is my code.
DefaultHttpClient httpclient = new DefaultHttpClient();
httpclient.getAuthSchemes().register("ntlm", new NTLMSchemeFactory());
httpclient.getCredentialsProvider().setCredentials(new AuthScope("masconsult.eu", -1),
new NTCredentials(username, password, "", ""));
HttpGet httpGet = new HttpGet(webserviceUrl);
httpGet.addHeader("Content-type", "application/json");
httpGet.getParams().setBooleanParameter(CoreProtocolPNames.USE_EXPECT_CONTINUE, false);
String responseXML = "";
HttpResponse response = httpclient.execute(httpGet);
response.getStatusLine().getReasonPhrase();
responseXML = EntityUtils.toString(response.getEntity());
Toast.makeText(this, responseXML, Toast.LENGTH_LONG).show();
I have an HTTP / 1.1 401 response Unauthorized. Even I added all the correct credentials. In the Chrome browser, it works fine with the same credentials. Plz suggest me any changes to the code.
source
share