Axis HTTP Vs Axis HTTPS Proxy Settings

Sankalp picture Sankalp · Feb 26, 2013 · Viewed 13.9k times · Source

My Java application deployed on Weblogic Cluster invokes two Webservices which are as follow.

• It sents SOAP Client request to External Application which is on internet) over HTTPS.(Java Classes created through Axis 1.4)

• Thereafter It sents SOAP Client request to internal Application(present on the other node which is connected to my LAN) over HTTP.(Java Classes created through JAX-WS:Jdeveloper Wizard)

In order to reach the 1st WS, I have to set the https proxy settings for the web service client using the following code:

System.setProperty("https.proxyHost", myProxyIP);  
System.setProperty("https.proxyPort", myProxyPort);  

Whereas the 2nd Web services doesn't need this proxy setting because they're already reachable on the network.

My problem is as follows:

If I call the 1st service (the one with the proxy setting), and then call the other , the Axis client tries to call these services with the same proxy setting, even if I remove the proxy setting from the System properties just before I am about to inoke the 2ns WS by writing

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

I read somwhere to use nonProxyHosts.But I am confused if should i write

System.setProperty("https.nonProxyHosts","secws.secondwsint.com");

or

System.setProperty("http.nonProxyHosts","secws.secondwsint.com");

http ot https, since the one that need to be bypassed is HTTP and the one we are setting proxy is HTTPS.

I also read in one of blog:

AxisProperties.setProperty("https.proxyHost", "bla1.bla1"); 
AxisProperties.setProperty("https.proxyPort", "8080"); 
AxisProperties.setProperty("https.nonProxyHosts", "secws.secondwsint.com"); 

but again confued wheather to use https.nonProxyHosts or http.nonProxyHosts

Which one would be advisable to use in my java program System.setProperty or AxisProperties.setProperty and importantly should i use http ot https for writing that codeline Also, Is there any other alternative?

Answer

Lan picture Lan · Feb 26, 2013

You can use both. But The System.setProperty() will also affect other HTTP related java function in your VM, while AxisProperties only affects Axis WS client. So I will pick AxisProperties.setProperty().

There is a bug in Axis problem with http proxy parameters caching mechanism . Basically the implementation caches the old proxy setting and does not read new settings. So even if you use AxisProperties.setProperty() method, it still does not work. I am not sure if it applies to Axis 1.4 or not, as the JIRA does not provide affected version number.

I also believe you should set http.nonProxyHosts because your internal WS uses HTTP, not HTTPS. But in another post, you mentioned that you set both and it does not work. Is that still the case?