title: Metro with jax-ws override endpoint address
body: <p>I'm creating a webservice client using <strong>Metro</strong> with <strong>jax-ws</strong> and I want to override the endpoint address. </p>
  
  <p>Using the following example from <strong>2.11.1. BindingProvider.ENDPOINT_ADDRESS_PROPERTY</strong> I can do that:
  <a href="http://metro.java.net/guide/How_to_invoke_and_endpoint_by_overriding_endpoint_address_in_the_WSDL.html" rel="nofollow">http://metro.java.net/guide/How_to_invoke_and_endpoint_by_overriding_endpoint_address_in_the_WSDL.html</a></p>
  
  <pre><code>//Create service and proxy from the generated Service class.
  HelloService service = new HelloService();
  HelloPort proxy = service.getHelloPort();
  
  ((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                                                      "http://new/endpointaddress");
  
  proxy.sayHello("Hello World!");
  </code></pre>
  
  <p>But I don't understand why I can't use the <em>service.getHelloPort().sayHello("Hello World!")</em> instead of <em>proxy.sayHello("Hello World!")</em> as the example shows. If I do, the webservice client is using its default endpoint address instead of the one I want to use.</p>
  
  <p>It looks like I'm getting a new instance of <em>HelloPort</em> every time I call <em>getHelloPort()</em></p>
  
  <p>Can anyone explain this?</p>