407 Proxy Authentication required
Am trying to consume a web service which is running on different sub-domain but on the same domain. I am getting 407 - Proxy Authentication Required. Not really sure this was firewall issue or my coding issue. Below is code which I am using to call the webservice from OSGI Component class.
String url = "https://banking.pnc.com";
PostMethod post = null;
BufferedReader br = null;
try {
HttpClient httpClient = new HttpClient();
post = new PostMethod(url);
post.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false));
String json_Params = "{\"token\":\"" + token + "\",\"usrName\":\"" + userName + "\",\"password\":\"" + password + "\"}";
StringRequestEntity requestEntity = new StringRequestEntity(json_Params, "application/json", "UTF-8");
post.setRequestEntity(requestEntity);
int statusCode = httpClient.executeMethod(post);
logger.debug("statusCode :::"+statusCode);
logger.debug("response body :::"+post.getResponseBodyAsString());
response.setStatus(statusCode);
} catch (Exception e) {
logger.error("Error while ", e);
} finally {
if (post != null)
post.releaseConnection();
if (br != null)
br.close();
}
Have done the proxy settings in OSGI Config "Day Commons HTTP Client 3.1",
Is my code is correct ? if I initiate HttpClient httpClient = new HttpClient(); will it will pass through the Proxy,as am i configured proxy in OSGI config "Day Commons HTTP Client 3.1" ?
Please do let me know if you need any more detials?
Thanks,
Chandra