title: Remap JAX-WS address
body: <p>My problem is that I have a web service that gets published by jboss at <code>http://localhost:8080/A</code>, where <code>A</code> is the service implementation class; I want a custom url <code>http://localhost:8080/B/C/D.ws</code>.</p>
  
  <p>In the wsdl, <code>soap:address</code> is correctly set <code>http://localhost:8080/B/C/D.ws</code>.</p>
  
  <p>During war deployment, service gets published at the "wrong" address:</p>
  
  <pre class="lang-none prettyprint-override"><code>INFO  [org.jboss.ws.cxf.metadata] Adding service endpoint metadata: id=org.example.ServiceImpl
   address=http://localhost:8080/ServiceImpl
   ...
  </code></pre>
  
  <p>The best I got was jboss publishing the ws at the wrong url, and then the address changed through a servlet; but a SOAP call to the "right" url returned a 404. This is <code>/WEB-INF/cxf-servlet.xml</code>:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml ... &gt;
  &lt;beans ...
      xmlns:jaxws="http://cxf.apache.org/jaxws" ... &gt;
      &lt;jaxws:endpoint
          id="someId"
          implementor="org.example.ServiceImpl"
          address="/B/C/D.ws" /&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>With the following <code>url-pattern</code> in <code>web.xml</code>:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;servlet&gt;
      &lt;servlet-name&gt;cxf&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.apache.cxf.transport.servlet.CXFServlet&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;cxf&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>This was the log:</p>
  
  <pre class="lang-none prettyprint-override"><code>17:41:53,648 INFO  [org.jboss.ws.cxf.metadata] Adding service endpoint metadata: id=org.example.ServiceImpl
   address=http://localhost:8080/ServiceImpl
   ...
  17:41:59,307 INFO  [org.apache.cxf.service.factory.ReflectionServiceFactoryBean] Creating Service {... targetNamespace ...}ServiceImplService from class org.example.ServicePort
  17:41:59,572 INFO  [org.apache.cxf.endpoint.ServerImpl] Setting the server's publish address to be /B/C/D.ws
  </code></pre>
  
  <p>Thanks</p>