Wednesday, July 22, 2009

Invoking an external web service using WID from behind the firewall


So, you imported a WSDL (from an external provider) onto your SCA module in WID, you tried invoking it, but you keep getting

javax.xml.ws.WebServiceException: java.net.ConnectException: Connection timed out: no further information
at org.apache.axis2.jaxws.ExceptionFactory.createWebServiceException(ExceptionFactory.java:180)
...


That's because the machine where the WSDL is being invoked from is behind the firewall.

So, to invoke an external web service from behind a firewall, you need to set your jvm system properties :
1) Open the administrative console. Click Servers ==> Application Servers ==> server ==> Java and Process Management ==> Process Definition ==> Java Virtual Machine ==> Custom Properties

2) Add these into the Generic JVM Arguments


name=http.proxySet value=true
name=http.proxyHost value=proxy.mycompany.com
name=http.proxyPort value=8080
name=http.proxyUser value=your_proxy_username_if_required
name=http.proxyPassword value=your_proxy_password_if_required
name=http.nonProxyHosts value=localhost|*.hosts.to.be.excluded.from.going.thru.proxy



Alternatively, you could add this to the generic JVM arguments of your JVM


-Dhttp.proxySet=true -Dhttp.proxyHost=proxy.mycompany.com -Dhttp.proxyPort=8080 -Dhttp.proxyUser=yourproxyusername -Dhttp.proxyPassword=yourproxypassword -Dhttp.nonProxyHosts=hostNamesOfMachinesToWhichRequestsWillNotBeSentThroughTheProxyServer



See Configuring additional HTTP transport properties using the JVM custom property panel in the administrative console



Don't forget to set your http.nonProxyHosts. If it is not set, all your http connections will go thru the proxy server, which you don't want to do. You only want your external web service requests to go thru the proxy server, but you want your internal web service requests to not go thru the proxy server.


See

http://java.sun.com/javase/6/docs/technotes/guides/net/proxies.html