2 Replies Latest reply on Jan 4, 2008 10:40 AM by ropalka

    contextRoot with multiple webservices

    fmeystre

      Hi,
      I have some problem with the contextRoot with multiple WebService (in different apps) with same name on same server.
      I'm running JBoss AS 4.2.1.GA with jbossws-native-2.0.1.GA.

      I have 2 deployed web applications (same java source code)

      First application is deployed at http://host/myApp1
      Second application is deployed at http://host/myApp2

      context root is set in the web.xml.

      for myApp1:

      <module>
       <web>
       <web-uri>myApp1.war</web-uri>
       <context-root>/myApp1</context-root>
       </web>
      </module>
      


      for myApp2:

      <module>
       <web>
       <web-uri>myApp2.war</web-uri>
       <context-root>/myApp2</context-root>
       </web>
      </module>
      


      Everything is working fine with the web application (using Seam 1.2.1 GA).
      The problem is with the WebService :

      The 2 WebServices are deployed under default context root :

      http://host/myApp1-myApp1/WSTest
      http://host/myApp2-myApp2/WSTest

      When I try to invoke the WebService WSTest from one client on
      http://host/myApp2-myApp2/WSTest

      it invokes the wrong service on the other app:
      http://host/myApp1-myApp1/WSTest

      Why is the wrong service invoked?
      I tried to change the context root like this : @WebContext(authMethod = "BASIC", contextRoot="/myApp1" ) but then I can't open the Webservice on http://host/myApp1/WSTest, Error 404
      By the way @WebContext and contextRoot="myApp1" is not a good solution for me, Because 2 apps share the same java source. I need a more dynamic way to change this. I see that we can change the context-root in jboss.xml, but regarding this post it is
      not working : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4078878#4078878

      here is my WebService, it use the EJB annotation

      @Stateless
      @WebService
      @SOAPBinding(style = SOAPBinding.Style.RPC)
      @WebContext(authMethod = "BASIC", transportGuarantee = "NONE", secureWSDLAccess = false)
      @SecurityDomain("JBossWS")
      @RolesAllowed("friend")
      
      public class WSTestBean implements WSTest{
      
       ...
      
       @WebMethod
       public void test(byte[] order) {
       ...
       }
      }
      


      For information I have user Seam-Gen to generate the project

      Thanks in advance for any help

      Fabian