I was looking for a suitable way to configure an HTTP proxy in a Spring web application. Unfortunately, every time I get results, these are AOP proxies, not HTTP proxies.
Basically, one module of my application starts configuring the webservice client in the Spring XML file with JAX-WS, giving something like:
<bean id="heartBeatWebservice" class="org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean"> <property name="serviceInterface" value="the.web.service.interface"/> <property name="wsdlDocumentUrl" value="http://thehost:theport/theservicename.wsdl"/> <property name="serviceName" value="TheServiceName"/> <property name="namespaceUri" value="http://the.namespace/"/> <property name="portName" value="TheWebServicePortName"/> </bean>
But my application needs to work behind an HTTP proxy to be able to call a web service, and I have to admit that I don't know how to do this in the context of Spring.
I tried in some main class that I wrote to try this code first:
System.setProperty("http.proxyHost", "my.proxy.addr"); System.setProperty("http.proxyPort", "8080");
Unfortunately, it did not work properly. I assume there is a good way to configure the HTTP proxy in the context of Spring, but cannot find out how ...
Can you give me a hint?
source share