title: Apache CXF Client for Dynamic Endpoints
body: <p>I'm now using Apache CXF as a web services client for a .NET service to get around NTLM authentication.  It works great, but I'm wondering why I can't seem to be able to set the web service target endpoint.  CXF seems to want the WSDL at runtime for some strange reason - not sure.  It takes the physical endpoint from the WSDL, which works fine in test environments I guess, but at deployment time it's sure to change.  </p>
  
  <p>Here's some code to demonstrate:</p>
  
  <pre><code>        MyWebServices service = new MyWebServices ();
          MyWebServicesSoap port = service.getMyWebServicesSoap12();
  
          // Turn off chunking so that NTLM can occur
          Client client = ClientProxy.getClient(port);
          HTTPConduit http = (HTTPConduit) client.getConduit();
          HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
          httpClientPolicy.setConnectionTimeout(36000);
          httpClientPolicy.setAllowChunking(false);
          http.setClient(httpClientPolicy);
  
          port.doSomethingUseful();
  </code></pre>
  
  <p>Again, there is no place that I can see in the CXF client API that allows me to set the service endpoint.  Not that I can see anyway.  In this case, the target is <a href="http://localhost/integration/webservices/mywebservices.asmx" rel="noreferrer">http://localhost/integration/webservices/mywebservices.asmx</a>, but I could be anywhere.  Surely this pedestrian problem is solved somehow?</p>