开发者

apache cxf: multiple endpoints or multiple CXFServlet servlets?

开发者 https://www.devze.com 2022-12-29 19:50 出处:网络
I have implemented an Apache CXF Webservice with multiple endpoints. I have successfully deployed the webservice.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号