我已经调用了具有代理设置的webservice,所以我做了以下基于 http 的webservices的代码:
System.setProperty("http.proxyHost","10.0.0.1");
System.setProperty("http.proxyPort","222");
System.setProperty("http.proxyUser","xyz");
System.setProperty("http.proxyPassword","pqr");// base64 password.
但是当我使用基于 https 的webservices的相同代码时:
System.setProperty("https.proxyHost","10.0.0.1");
System.setProperty("https.proxyPort","222");
System.setProperty("https.proxyUser","xyz");
System.setProperty("https.proxyPassword","pqr");// base64 password.
它给了我以下例外:
Caused by: java.io.IOException: Unable to tunnel through proxy. Proxy returns "HTTP/1.0 407 Proxy Authentication Required"
或者还有其他方法可以调用Https webservice吗?
谢谢..
答案 0 :(得分:1)
Try this and let me know that helps..
System.getProperties().put("http.proxyHost", "someProxyURL");
System.getProperties().put("http.proxyPort", "someProxyPort");
System.getProperties().put("http.proxyUser", "someUserName");
System.getProperties().put("http.proxyPassword", "somePassword");
http://viralpatel.net/blogs/http-proxy-setting-java-setting-proxy-java/