title: How do I specify url in JAX-WS call and avoid initial network connection?
body: <p>I'm using JAX-WS standard stuff with <code>wsimport http://localhost/Order.wsdl</code> to generate client stub classes.</p>
  
  <p>The live web service is on a different host, so I need to supply a url when I make the service call. My approach so far has been like this (classes below are generated from wsimport):</p>
  
  <pre><code> 1. OrderService s = new OrderService (
                                         new URL("https://live/WS/Order"), 
                                         new QName(...));
   2. OrderServicePort port = s.getOrderServicePort();
  
   3. configureHttpCertificatesStuff(port) // Set up ssl stuff with the port
  
   4. port.placeOrder(args); // The actual ws call
  </code></pre>
  
  <p><em>First:</em> Is this the correct way of specifying the url?</p>
  
  <p><em>Second:</em> It seems the constructor in line 1 actually <strong>makes a network call</strong> to the new URL! This results in an exception (due to https not being configured), so I never get to the next line.</p>
  
  <p>Background: I am implementing two-way ssl auth as outlined in <a href="https://stackoverflow.com/questions/11001102/how-to-programmatically-set-the-sslcontext-of-a-jax-ws-client">this question</a>. This means I need to configure ssl stuff in the <code>port</code> before the service call. I can't have the constructor make any connection before I've configured the ssl layer correctly for obvious reasons...</p>
  
  <p><strong>Update:</strong></p>
  
  <p>Apparenty the url is to the WSDL, not the endpoint when using jax-ws standard. This tripped me up. Loading the WSDL directly from file solved that problem. </p>
  
  <p>Setting the endpoint url is done like this:</p>
  
  <pre><code>BindingProvider b = (BindingProvider) port;        
  b.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointUrl);
  </code></pre>