title: wsimport result has a different runtime endpoint
body: <p>This is an odd one.</p>
  
  <p>I'm generating client code for a soap service using a wsimport plugin for maven like this...</p>
  
  <pre><code>        &lt;plugin&gt;
            &lt;groupId&gt;org.jvnet.jax-ws-commons&lt;/groupId&gt;
            &lt;artifactId&gt;jaxws-maven-plugin&lt;/artifactId&gt;
            &lt;version&gt;2.1&lt;/version&gt;
            &lt;executions&gt;
              &lt;execution&gt;
                &lt;goals&gt;
                  &lt;goal&gt;wsimport&lt;/goal&gt;
                &lt;/goals&gt;
                &lt;configuration&gt;
                  &lt;wsdlUrls&gt;
                    &lt;wsdlUrl&gt;${testWsdlLocationUrl}&lt;/wsdlUrl&gt;
                  &lt;/wsdlUrls&gt;
                  &lt;destDir&gt;${basedir}/target/jaxws&lt;/destDir&gt;
                &lt;/configuration&gt;
              &lt;/execution&gt;
            &lt;/executions&gt;
          &lt;/plugin&gt;
  </code></pre>
  
  <p>...where I've parameterised the external wsdlUrl. I can see where the wsdl url (fudged for anonymity) is defined in the generated client like this...</p>
  
  <pre><code>static {
      URL url = null;
  
      try {
          URL e = SpecialService.class.getResource(".");
          url = new URL(e, "http://theUrlThatIDefinedAbove:withTheCorrectPortNumber/blahblah?wsdl");
      } catch (MalformedURLException var2) {
          logger.warning("Failed to create URL for the wsdl Location: \'http://theUrlThatIDefinedAbove:withTheCorrectPortNumber/blahblah?wsdl\', retrying as a local file");
          logger.warning(var2.getMessage());
      }
  
      SPECIALSERVICE_WSDL_LOCATION = url;
  }
  </code></pre>
  
  <p>...so all looks fine so far. The build creates a jar containing only the compiled code generated from wsimport.</p>
  
  <p>However, when I refer to this generated client in my code to call the service, the endpoint is different! Here's (the gist of) what I do...</p>
  
  <pre><code>this.serviceEndpoint = new SpecialService().getSpecialServiceHttpSoap11Endpoint();
  </code></pre>
  
  <p>this.serviceEndpoint.callTheSpecialMethodOnTheService(withSomeDataOrOther)</p>
  
  <p>Simple enough eh? However, I get a timeout exception.</p>
  
  <p>When I look at the service endpoint like this:</p>
  
  <pre><code>System.out.println("Service Endpoint : " + this.serviceEndpoint.toString());
  </code></pre>
  
  <p>I get (something like)...</p>
  
  <pre><code>Service Endpoint : JAX-WS RI 2.2.4-b01: Stub for http://theCorrectUrlHere:8080/withTheCorrectPath/
  </code></pre>
  
  <p>...where did 8080 come from? It's not on the wsdl url I specified.</p>
  
  <p>Curiously if I manually change the service endpoint like this...
      ((BindingProvider)this.serviceEndpoint).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "theCorrectUrlAndPort")</p>
  
  <p>...everything works fine and I can happily access the remote service.</p>
  
  <p>Have I missed something obvious? I assumed that giving wsimport the wsdl location would bake the correct endpoint into the client code, and it certainly looks that way with the host and path data being correct but the port being wrong.</p>
  
  <p>Have I done something foolish with the wsimport plugin perhaps? Do I need to supply the port in wsimport perhaps?</p>
  
  <p>I would be grateful for any suggestions you can provide.</p>
  
  <p>EDIT</p>
  
  <p>Following Leo's suggestion, here's the new plugin config...</p>
  
  <pre><code>&lt;testWsdlLocationUrl&gt;http://editedOutHost:portThatIsNot8080/the/rest/of/the/path?wsdl&lt;/testWsdlLocationUrl&gt;
  </code></pre>
  
  <p>...</p>
  
  <pre><code>        &lt;plugin&gt;
              &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
              &lt;artifactId&gt;jaxws-maven-plugin&lt;/artifactId&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;generate-stubs&lt;/id&gt;
                      &lt;phase&gt;process-classes&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;wsimport&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;configuration&gt;
                          &lt;wsdlUrls&gt;
                              &lt;wsdlUrl&gt;${testWsdlLocationUrl}&lt;/wsdlUrl&gt;
                          &lt;/wsdlUrls&gt;
                          &lt;wsdlLocation&gt;${testWsdlLocationUrl}&lt;/wsdlLocation&gt;
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
  </code></pre>
  
  <p>Please note it is pointing to a remote wsdl location rather than a local one in your commented example.</p>
  
  <p>The change of plugin generates the classes in the same way as in my original question, on decompilation both point to the correct host port and path, and both still exhibit the same problem of defaulting the port back to 8080.</p>
  
  <p><strong>* UPDATED *</strong></p>
  
  <p>The same problem occurs when I manually run wsimport from the command line and jar up the resulting classes, so I don't think the use of maven is the source of the problem.</p>