title: How do I best implement a web service client inside a web application?
body: <p>I've got a service running at a fixed location in the network, with a WSDL attached etc. I can easily create a jax-ws client with wsimport and the usual stuff when doing this stand-alone, but I'd really like to be able to call this service from inside another web application.</p>
  
  <p>Unfortunately I'm running into some gotchas here. For one, everything works pretty well in a regular web container, but not on jboss, which apparently puts some incompatible classes in the endorsed directory making deployment fail with:</p>
  
  <pre><code>java.lang.ClassCastException: com.sun.xml.ws.client.WSServiceDelegate cannot be cast to javax.xml.ws.spi.ServiceDelegate21
  </code></pre>
  
  <p>There's a blog entry somewhere that proposes to fix this by deleting the endorsed jax-ws jars, but this might end up breaking something else on this particular server and so I was wondering if there isn't a better way to isolate this further? Completely relying on j2ee specific support is possibly an option but I'd really like to retain the ability to deploy the app on a simple web container as well (jetty, tomcat, ...).</p>