我试图通过eclipse中的java程序连接到wsdl生成的客户端的Web服务.我通过代理服务器传递我的请求.但似乎请求没有通过.相同的代理设置在SoapUI上正常工作.请在下面找到我设置的系统属性.
Properties props= new Properties(System.getProperties());
props.put("http.proxySet", "true");
props.put("http.proxyHost", "10.x.x.x");
props.put("http.proxyPort", "80");
props.put("http.proxyUser","domainName\\xxx");
props.put("http.proxyPassword","xxx");
Properties newprops = new Properties(props);
Run Code Online (Sandbox Code Playgroud)
Java程序抛出一个异常 java.net.UnknownHostException:
我错过了什么?
小智 9
java -Dhttp.proxyHost=proxyhostURL
-Dhttp.proxyPort=proxyPortNumber
-Dhttp.proxyUser=someUserName
-Dhttp.proxyPassword=somePassword javaClassToRun
Run Code Online (Sandbox Code Playgroud)
http://i4t.org/2007/05/04/java-http-proxy-settings/
小智 7
如果您使用HTTPS连接webservice,那么要设置的代理属性是
https.proxyHost
https.proxyPort
Run Code Online (Sandbox Code Playgroud)
(http://docs.oracle.com/javase/6/docs/technotes/guides/net/proxies.html)
我使用以下代码(并且可以使用):
String host = "10.x.x.x";
String port = "80";
System.out.println("Using proxy: " + host + ":" + port);
System.setProperty("http.proxyHost", host);
System.setProperty("http.proxyPort", port);
System.setProperty("http.nonProxyHosts", "localhost|127.0.0.1");
Run Code Online (Sandbox Code Playgroud)
不存在这样的属性http.proxySet。
您需要在使用任何 HTTP URL 之前设置其他属性,之后更改它们不会产生任何效果。
如果您需要动态更改代理,请参阅 java.net.Proxy。
“明文连接?” 其含义正如其所言:您正在对非 SSL 目标(可能是明文目标)使用 SSL。