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.
精彩评论