0

I have a web app which consumes two webservice

• The 1st Webservice connects to external websserver over HHTPS

(https://abc.com/int/obj)

• The 2nd Webservice connects to internal websserver over HHTP

`(http://10.14.250.69:7250/uiu/ohg)

If i use

System.setProperty("https.proxyHost", "xxx.xxx.xx.xxx"); //proxy server
 System.setProperty("https.proxyPort", "3128");           //proxy port

Then my application is able to connect successfully with the external website and fetch data, but when it invokes the 2nd Webservice the request are routed to the proxy Server which should not happen

All I want when it connects to this internal Webservice it should call it directly and not via proxy. How can I acheive that.Hoe can I bypass when the proxy server when it invkoes the interna Webservice

tckmn
  • 57,719
  • 27
  • 114
  • 156
Sankalp
  • 173
  • 2
  • 9
  • 25
  • 1
    Please don't include "KINDLY HELP" in your question. It is useless noise. Also, don't capitalize random words. – tckmn Feb 26 '13 at 14:07

2 Answers2

1

It is good to know that you are using Axis WS client. So instead of using the System properties that apply to both web services, can you set proxy setting at individual WS client stub level? Here is the sample code

MyServiceStub myService = new MyServiceStub("https://www.foo.com/abc/xyz.asmx");

HttpTransportProperties.ProxyProperties proxyProperties = new HttpTransportProperties.ProxyProperties();
proxyProperties.setDomain("mydomain");
proxyProperties.setProxyName("xx.xxx.xx.xxx");
proxyProperties.setProxyPort(80);
proxyProperties.setUserName("myusername");
proxyProperties.setPassWord("mypassword");
myService._getServiceClient().getOptions().setProperty(HTTPConstants.PROXY, proxyProperties);
Lan
  • 6,470
  • 3
  • 26
  • 37
  • I cannot find the suitable package for the above code in my Jdeveloper. Also I would be writing this code after I create stub? This is how I am creating Stub in my program CustomObject5_BindingStub stub = (CustomObject5_BindingStub)service.getCustomObject5(urlAddr); in my case, ryt – Sankalp Feb 26 '13 at 20:14
  • yeah, giving me the version number helps. :-) My code is for Axis 2. – Lan Feb 26 '13 at 20:25
  • I am hopeless now.I dont know what to do.Your code was awesome but your last reply unfortunately crashed my heart :( Last Question: How can we do it through Axis 1.4 – Sankalp Feb 26 '13 at 20:31
  • I have bad news. I found a old axis bug, which might be related to your issue https://issues.apache.org/jira/browse/AXIS-2295. 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. Just try to verify if this is your case, since the JIRA case does not mention the Axis version it affects – Lan Feb 26 '13 at 20:58
  • @ Surge..There is a Hope.I have rephrased my question.Kindly have a look and provide our valuable suggestion .Click this new Link: http://stackoverflow.com/questions/15098044/axis-http-vs-axis-https-proxy-settings – Sankalp Feb 26 '13 at 21:08
0

Configure http.nonProxyHosts - a list of hosts or domains to connect to directly, separated by the "pipe" character | by adding 10.14.250.69 to the list.

Boris Pavlović
  • 63,078
  • 28
  • 122
  • 148
  • you mean I should have something like this System.setProperty("https.proxyHost", "xxx.xxx.xx.xxx"); //proxy server System.setProperty("https.proxyPort", "3128"); //proxy port System.setProperty("http.nonProxyHosts", "10.14.250.69|soaweb.xyz.com"); but then the question is I am setting Proxy port and Host using HTTPS while you say to set bypass i need to write http? – Sankalp Feb 26 '13 at 14:15
  • try also with `htts.nonProxyHosts` :) – Boris Pavlović Feb 26 '13 at 14:26
  • It should be https.nonProxyHosts, not htts.nonProxyHosts. @Sankalp, hope you did not just copy and paste from Boris's comment. :-) – Lan Feb 26 '13 at 14:59
  • @Sankalp, what application server and/or web service runtime do you use? – Lan Feb 26 '13 at 15:00
  • @Surge: I tried using both https.nonProxyHost as well as http.nonProxyHost, but none worked.Using this one things happen, the request does not go to Proxy Server either to 10.14.250.69.Also I have deployed my application on Weblogic and genrated java proxy using Axis Client – Sankalp Feb 26 '13 at 17:55
  • Not sure what you mean by saying "the request does not go to Proxy Server either to 10.14.250.69". Anyway, I posted my answer that suggest setting the proxy setting at WS client level instead of System level. – Lan Feb 26 '13 at 18:53