4

Basically, I'm trying to make SOAP calls from a Tomcat server via a corporate proxy/ firewall (which I have no direct control over), I've tried to add info to the catalina.properties file as shown:

http.proxyPort=80
http.proxyHost=www-proxy.company.com

I'm still getting timeouts in the stdout logs. Do I need to do anything else and if not is there another way to test the SOAP calls?

crb
  • 7,928
  • 37
  • 53
alimack
  • 933
  • 2
  • 11
  • 21

4 Answers4

8

Create a setenv.sh (or setenv.bat if running windows), if you don't already have one, and add the following java options:

JAVA_OPTS="-Dhttp.proxySet=true -Dhttp.proxyHost=<proxy_hostname> -Dhttp.proxyPort=<port_number> -Dhttp.nonProxyHosts=<domain_one>|<domain two> $JAVA_OPTS"

This should work nicely.

mahnsc
  • 1,776
  • 13
  • 11
  • `http.nonProxyHosts (default: localhost|127.*|[::1])` prevents testing localhost APIs, so I am using this setting for that case `-Dhttp.nonProxyHosts=` (empty value) to override default. See https://docs.oracle.com/javase/7/docs/api/java/net/doc-files/net-properties.html – David Oct 28 '19 at 05:59
  • '|' will be pasred as pipeline operator, as tomcat using `eval` – WestFarmer Oct 15 '21 at 07:08
  • For Tomcat 9, it fails to read the nonProxyHosts with a "|" in it. Does the value have to be surrounded by quotes to have it work?? Example: `-Dhttp.nonProxyHosts=*.google.com|*.yahoo.com` – dev4life Feb 24 '22 at 14:14
2

You can implement HTTP proxy, https proxy and non-http proxy also in tomcat. You need to update two files i.e, ../bin/Catalina.sh and ../conf/cataliana.properties.

Detailed configuration and steps are mentioned here : http://w3devops.com/add-http-https-proxy-http-non-proxy-jenkins-via-tomcat-server/

stambata
  • 1,598
  • 3
  • 13
  • 18
0

If you only need soap calls to go via proxy, you can use jproxyloader. With this library you can pass soap calls via proxy and all the other calls will not use proxy. See http://jproxyloader.sourceforge.net/examples/web-application-on-tomcat.html for complete setup.

walkeros
  • 101
  • 2
-1

To get tomcat running inside my docker container I used the following settings:

JAVA_OPTS=-Dhttps.proxyHost=PROXYHOST -Dhttps.proxyPort=PROXYPORT -DproxySet=true -DproxyHost=PROXYHOST -DproxyPort=PROXYPORT