robinmag
robinmag

Reputation: 18100

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 ? ...

and

Upvotes: 1

Views: 5567

Answers (2)

bug11
bug11

Reputation: 356

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.

Upvotes: 2

Chris Dolan
Chris Dolan

Reputation: 8963

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.

Upvotes: 1

Related Questions