Interview Questions

My SOAP Service needs to make external connections to other sites but it is behind a proxy server. How do I configure this?

SOAP Interview Questions and Answers


(Continued from previous question...)

My SOAP Service needs to make external connections to other sites but it is behind a proxy server. How do I configure this?

Suppose your proxy server is called "proxy.foo.com" and it is on port 9999. There are a couple of ways of configuring Apache to use a proxy. Solution A1, using the JVM capabilities to deal with proxies:

System.getProperties().put("proxySet","true");
System.getProperties().put("proxyHost","proxy.foo.com");
System.getProperties().put("proxyPort","9999");


Solution A2, for socks:

System.getProperties().put("socksProxyHost","socks.foo.com");
System.getProperties().put("socksProxyPort","1080");


Solution B1 (similar to solution A, except that you are telling TOMCAT to the proxying via the variable TOMCAT_OPTS), for HTTP proxies:

set TOMCAT_OPTS="-DproxyHost=proxy.foo.com -DproxyPort=9999"

Solution B2, for socks:

set TOMCAT_OPTS="-DsocksProxyHost=socks.foo.com -DsocksProxyPort=1080"

(Continued on next question...)

Other Interview Questions