title: SOAP connections through a proxy using URLEndpoint
body: <p>I've had to update a previous java application that requests a SOAP response from an external web service. This service is outside our firewall which now requires us to go through a proxy instead of hitting the URL directly.</p>
  
  <p>Currently the Java App uses URLEndpoint that takes a string for the URL. Usually when I am getting to a URL through a proxy I create a URL like so:</p>
  
  <pre><code>URL url = new URL("http", "theproxy.com", 5555, finalUrl);
  </code></pre>
  
  <p>The problem is URLEndpoint only takes a string for the url, I tried to convert URL to string using toExternalForm() but it malformed the URL.</p>
  
  <p>Any ideas as to a way around this?</p>
  
  <p>EDIT: I can't use System.setProperty as this runs with a whole heap of other Java applications in tomcat.</p>
  
  <p>second edit: I can't set a system properties as it will override all other applications running on the server, I can't use jsocks as the proxy we run through squid proxy which does not support socks4/5</p>
  
  <p>Any help appreciated.</p>