title: Configuring an HTTP proxy in a Spring web app
body: <p>I have been searching around for a proper way to configure an HTTP proxy in a Spring web application. Unfortunately, each time the results I get are about AOP proxies and not HTTP proxies.</p>
  
  <p>Basically, one module of my application is running a webservice client configure in the Spring XML file with JAX-WS, giving something like :  </p>
  
  <pre><code>&lt;bean id="heartBeatWebservice" class="org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean"&gt;  
      &lt;property name="serviceInterface" value="the.web.service.interface"/&gt;  
      &lt;property name="wsdlDocumentUrl" value="http://thehost:theport/theservicename.wsdl"/&gt;  
      &lt;property name="serviceName" value="TheServiceName"/&gt;  
      &lt;property name="namespaceUri" value="http://the.namespace/"/&gt;  
      &lt;property name="portName" value="TheWebServicePortName"/&gt;  
  &lt;/bean&gt;
  </code></pre>
  
  <p>But my app has to run behind an HTTP proxy for being able to call the web service, and I must acknowledge that I don't know how to do it properly within the Spring context.</p>
  
  <p>I tried in some main class that I wrote to try out this code at first :  </p>
  
  <pre><code>System.setProperty("http.proxyHost", "my.proxy.addr");  
  System.setProperty("http.proxyPort", "8080");  
  </code></pre>
  
  <p>Unfortunately, it didn't work as expected. I assume there is a nice way to configure an HTTP proxy in a Spring context but can't find out how ...</p>
  
  <p>Can you give me a hint ?</p>