Axis HTTP Vs Axis HTTPS代理设置

San*_*alp 3 java proxy axis web-services proxy-classes

部署在Weblogic Cluster上的我的Java应用程序调用两个Web服务,如下所示.

•它通过HTTPS将SOAP客户端请求发送到Internet上的外部应用程序.(通过Axis 1.4创建的Java类)

•此后它通过HTTP将SOAP客户端请求发送到内部应用程序(存在于连接到我的LAN的另一个节点上).(通过JAX-WS创建的Java类:Jdeveloper向导)

为了达到第一个WS,我必须使用以下代码为Web服务客户端设置https代理设置:

System.setProperty("https.proxyHost", myProxyIP);  
System.setProperty("https.proxyPort", myProxyPort);  
Run Code Online (Sandbox Code Playgroud)

而第二个Web服务不需要此代理设置,因为它们已在网络上可访问.

我的问题如下:

如果我调用第一个服务(具有代理设置的服务),然后调用另一个服务,则Axis客户端尝试使用相同的代理设置调用这些服务,即使我在我之前从系统属性中删除了代理设置即将通过写作来介绍2ns WS

 System.setProperty("http.proxySet", "false");  
    System.getProperties().remove("http.proxyHost");  
    System.getProperties().remove("http.proxyPort");  
    AxisProperties.setProperty("http.proxyHost", null);  
    AxisProperties.setProperty("http.proxyPort", null);
Run Code Online (Sandbox Code Playgroud)

我读somwhere使用nonProxyHosts.But我很困惑,如果我应该写

System.setProperty("https.nonProxyHosts","secws.secondwsint.com");
Run Code Online (Sandbox Code Playgroud)

要么

System.setProperty("http.nonProxyHosts","secws.secondwsint.com");
Run Code Online (Sandbox Code Playgroud)

http ot https,因为需要绕过的是HTTP,而我们设置代理的是HTTPS.

我也读过一篇博客:

AxisProperties.setProperty("https.proxyHost", "bla1.bla1"); 
AxisProperties.setProperty("https.proxyPort", "8080"); 
AxisProperties.setProperty("https.nonProxyHosts", "secws.secondwsint.com"); 
Run Code Online (Sandbox Code Playgroud)

但再一次让天使用https.nonProxyHosts或http.nonProxyHosts

哪一个在我的java程序中使用是可取的,System.setProperty或者更AxisProperties.setProperty重要的是我应该使用http ot https来编写该代码行此外,还有其他选择吗?

Lan*_*Lan 6

你可以使用两者.但System.setProperty()也会影响VM中其他与HTTP相关的java函数,而AxisProperties仅影响Axis WS客户端.所以我将选择AxisProperties.setProperty().

Axis 问题与http代理参数缓存机制有一个错误.基本上,实现缓存旧的代理设置,并且不读取新设置.因此,即使您使用AxisProperties.setProperty()方法,它仍然无法正常工作.我不确定它是否适用于Axis 1.4,因为JIRA不提供受影响的版本号.

我也相信你应该设置http.nonProxyHosts,因为你的内部WS使用HTTP,而不是HTTPS.但在另一篇文章中,你提到你设置了两个并且它不起作用.那还是这样吗?