Search code examples
soapcxfjax-wsapache-tomee

change default /webservices path for Apache CXF SOAP service


I'm using tomEE 1.7.1 with Apache CXF 2.6.14 inside.

I have a component that serves a WSDL first web service:

        @Stateless
        @WebService(
                endpointInterface   = "com.mycompany.SecurityTokenServiceWS", 
                targetNamespace     = "http://sts.mycompany/wsdl/", 
                serviceName         = "SecurityTokenService", 
                portName            = "TokenService")
        @SOAPBinding(style = SOAPBinding.Style.RPC, use = SOAPBinding.Use.LITERAL) 
        public class TokenService implements SecurityTokenServiceWS {

        //service methods
    }

When I deploy the web app, I see this log:

Jan 30, 2015 12:47:22 PM org.apache.openejb.server.webservices.WsService deployApp
INFORMATION: Webservice(wsdl=http://localhost:8080//webservices/TokenService, qname={http://sts.mycompany.com/wsdl/}SecurityTokenService) --> Ejb(id=TokenService)

In result the web service is available on: http://localhost:8080/webservices/TokenService.

What I like to have is that the service runs directly on: http://localhost:8080/TokenService.

I have no idea where the "webservices" path element comes from. It isn't in the WSDL and not in any configuration file. My web application runs directly under the context path / (ROOT).

Is there a magic CXF servlet that is bonded to /webservices? How can I change this behavior?


Solution

  • this comes from TomEE which uses subcontext webservices by default.

    This sample shows how to change it https://git-wip-us.apache.org/repos/asf?p=tomee.git;a=tree;f=examples/change-jaxws-url;h=2f88382bd4f925ec27c7305e74d361c8baf46a92;hb=ebe63371a22709a50e79c42206b5e9a0fd8946cc (the interesting file is https://git-wip-us.apache.org/repos/asf?p=tomee.git;a=blob;f=examples/change-jaxws-url/src/main/resources/META-INF/openejb-jar.xml;h=6c0ba44b14eb2e67a550c65d890d325c8bf409b7;hb=ebe63371a22709a50e79c42206b5e9a0fd8946cc)

    Note: if you just want to rename /webservices you can set in conf/system.properties tomee.jaxws.subcontext=/myothersubcontext

    PS: if you go with openejb-jar.xml solution note there is the equivalent for openejb-jar.xml 1.1 which is just the property openejb.webservice.deployment.address in your ejb-deployment properties