简体   繁体   English

apache cxf:多个端点还是多个CXFServlet servlet?

[英]apache cxf: multiple endpoints or multiple CXFServlet servlets?

I have implemented an Apache CXF Webservice with multiple endpoints. 我已经实现了具有多个端点的Apache CXF Web服务。

I have successfully deployed the webservice. 我已经成功部署了Web服务。

The problem I have is all the endpoints WSDL appear in the same servlet URL. 我遇到的问题是所有端点WSDL都出现在同一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 ? 我可以在同一web.xml拥有两个org.apache.cxf.transport.servlet.CXFServlet类型的servlet,并让每个servlet服务一个端点,以便于我吗? ... ...

  • Endpoint 1 at http:/localhost/app/ endpoint1 位于http:// localhost / app / endpoint1的端点1

and

  • Endpoint 2 at http:/localhost/app/ endpoint2 位于http:// localhost / app / endpoint2的端点2

What is the motivation for using 2 CXFServlets? 使用2个CXFServlet的动机是什么? CXF supports multiple endpoints per servlet instance. CXF每个Servlet实例支持多个端点。

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. ..其中service1Impl和service2Impl是实现服务接口的bean。

Can you provide more detail about your deployment? 您能否提供有关部署的更多详细信息? Jetty? 码头? Tomcat? 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. 但是我自己还没有尝试过。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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