简体   繁体   中英

apache cxf: multiple endpoints or multiple CXFServlet servlets?

I have implemented an Apache CXF Webservice with multiple endpoints.

I have successfully deployed the webservice.

The problem I have is all the endpoints WSDL appear in the same servlet URL.

Can I have two servlets of type org.apache.cxf.transport.servlet.CXFServlet in the same web.xml and have each servlet serve one endpoint so that I the following ? ...

  • Endpoint 1 at http:/localhost/app/ endpoint1

and

  • Endpoint 2 at http:/localhost/app/ endpoint2

What is the motivation for using 2 CXFServlets? CXF supports multiple endpoints per servlet instance.

Can be configured numerous ways. One example:

<jaxws:endpoint id="endpoint1" 
  implementor="#service1Impl" 
  address="/endpoint1">...</jaxws:endpoint>

<jaxws:endpoint id="endpoint2" 
  implementor="#service2Impl" 
  address="/endpoint2">...</jaxws:endpoint>

..where service1Impl and service2Impl are beans implementing your service interfaces.

Can you provide more detail about your deployment? Jetty? Tomcat? Something else?

From the docs , it looks like it's as simple as

Endpoint.publish("/service1", new ServiceOneImpl());
Endpoint.publish("/service2", new ServiceTwoImpl());

But I have not tried that myself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM