title: How to send a SOAP message through a proxy that needs authentication?
body: <p>I'm writing a servlet in java 1.7 hosted in Apache Tomcat 7, and I'm trying to send a SOAP 1.2 message to a web service. Not a very challenging feature, so I wrote this little bit of code to do it:</p>
  
  <pre><code>    SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
      SOAPConnection soapConnection = soapConnectionFactory.createConnection();
  
      String url = petition.getUrl();
      SOAPMessage soapResponse = soapConnection.call(createSOAPRequest(xml), url);
  </code></pre>
  
  <p>The problem is that my company proxy is stopping the call and I'm always getting a Timeout Exception. I've found that I can set proxy settings like this, but it doesn't include a way to introduce the proxy authentication I need to complete the call.</p>
  
  <pre><code>//Set the http proxy to webcache.example.com:8080
  System.setProperty("http.proxyHost", "webcache.example.com");
  System.setProperty("http.proxyPort", "8080");
  </code></pre>
  
  <p>Is there a way to log me in the proxy without having to use URLConnection to send the SOAP message?</p>