Search code examples
javaweb-servicesjbossjax-wswildfly

Change exposed WebService URL in Wildfly


I have a webapplication currently working under Glassfish 4.0 and want to modify it to work under Wildfly 8.2. The problem I currently have is:

I have some Webservices (with annotation @WebService) wich currently are published under /ws/

f.e. "PanelService" would be exposed under /myAppContextRoot/ws/PanelService

I did this by binding the Glassfish-WS-Servlet (ergo JAXWS-RI) to /ws/* in web.xml. Is there a comparable way for Wildfly preferable without using Wildfly specific annotations - just by configuration? I don´t want to have jboss-classes in my classpath.

My current "solution" is to add JAXWS-RI to the classpath and publish the services two times - by JBoss-WS and JAXWS-RI :-(

€edit:

The solution of Terrence Curran actually works..... but.... I had to add minor changes.

  • What I didn´t know: had to place the file under src/main/webapp/META-INF (Maven Web project) - tried src/main/resources/META-INF before...
  • the context-root had to contain my app-name..... my jboss-webservices.xml is now:

.

<webservices>
    <context-root>myApp/ws</context-root>
</webservices>
  • I had to mark at least one of the webservices as @Stateless EJB. Don´t ask me why - but if I remove the annotation the file doesn´t seem to get parsed and applied. Only if there is one WS present also as EJB my wildlfy will apply the jboss-webservices.xml. (Bug?)

Solution

  • I would also look at defining the context-root in a jboss-webservices.xml file. This way you can avoid modifying your web.xml which will break your deployment in GlassFish.

    <webservices>
        <context-root>ws</context-root>
    </webservices>