Using A Proxy To Call A Webservice

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Using a proxy to call a webservice

In some cases, you're stuck behind a firewall, and thus unable to call a webservice directly.
This document shows you how to configure the JVM to use a proxy to call such services.

Proxy host and proxy port


There are two JVM parameters (system properties) that specify which proxy server to use.
These are http.proxyHost and http.proxyPort
You can specify these in your .m2eerc under JVM parameters:
...
# custom java options, like -Xmx256m or -Djava.foo=bar
javaopts: [ "-Dfile.encoding=UTF-8", "-Dsun.io.useCanonPrefixCache=false", "XX:MaxPermSize=64M", "-Xmx128M", "-Xms128M", "-Dhttp.proxyHost=myproxyserver.com", "Dhttp.proxyPort=3128"]
...

or directly (when calling from, for instance, eclipse):


-Dhttp.proxyHost=myproxyserver.com
-Dhttp.proxyPort=3128

Proxy user and password


Some proxies require authentication. To specify the user and password, simply pass two
JVM parameters:
-Dhttp.proxyUser=myusername
-Dhttp.proxyPassword=mypassword

SSL
You can also connect while using a secure sockets layer (ie https). To configure the proxy,
you need to specifydifferent proxy settings to connect. These settings are called
https.proxyHost and https.proxyPort. In addition, you need to import the ssl certificate of the
proxy server into your java keystore. More info can be found on the Oracle website

You might also like