java程序中的代理设置 [英] Proxy settings in a java program

查看:104
本文介绍了java程序中的代理设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过eclipse中的java程序连接到wsdl生成的客户端的Web服务。我通过代理服务器传递我的请求。但似乎请求没有通过。相同的代理设置在SoapUI上正常工作。请在下面找到我设置的系统属性。

I am trying to connect to a web service with a client generated from wsdl through a java program in eclipse. I am passing my request through a proxy server. But it seems that request is not getting through. Same proxy settings are working fine on SoapUI. Please find below the system properties set by me.

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);

Java程序抛出异常,因为 java.net.UnknownHostException:

Java program throws an exception as java.net.UnknownHostException:

我缺少什么?

推荐答案

java -Dhttp.proxyHost=proxyhostURL
     -Dhttp.proxyPort=proxyPortNumber
     -Dhttp.proxyUser=someUserName
     -Dhttp.proxyPassword=somePassword javaClassToRun

http://i4t.org/2007/05/04/java-http-proxy-settings/

这篇关于java程序中的代理设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆