Tuesday, June 23, 2009

wsimport - with a proxy

wsimport supports getting WSDL from a remote site using a proxy, via the "httpproxy" parameter. However I have read (haven't tried it) that this parameter doesn't support proxies which require you to enter username and password, which in yer standard corporate environment is likely to be the case. So here's an alternative. You can also enter the following when you start up the JVM which is going to run wsimport (e.g. when you start Ant):

-Djava.net.useSystemProxies=true

This tells Java to use the default proxy which has been defined for the system. On Windows, this is the proxy which is set up in Internet Explorer. I found this useful tip here.

HOWEVER! The problem I've subsequently discovered with this is that, on Windows, Oracle clients seem to use the same setting, so when you try to get a JDBC connection when useSystemProxies is true, you won't get a connection. How annoying. So you have to be really careful how you set up your proxy rules... in the situation I'm in, I've left the useSystemProxies=true, but it means I've had to add my database server host to my proxy exceptions list in Internet Explorer! Sounds like a fudge, but it works...

No comments: