Hello!
I need to dynamically bind and unbind service Endpoints with HTTP-Servlet
Transport. To test it I used this snippet:
<pre>
Server server = new Server(8080);
Context root = new Context(server, "/", Context.SESSIONS);
CXFServlet servlet = new CXFServlet();
BusFactory.setDefaultBus(servlet.getBus());
HelloWorldImplementation service = new
HelloWorldImplementation();
root.addServlet(new ServletHolder(servlet), "/*");
server.start();
Endpoint endpoint = Endpoint.publish("/testService", service);
Thread.sleep(5000);
endpoint.stop();
Thread.sleep(5000);
endpoint = Endpoint.publish("/testService", service);
</pre>
This only publishes a service, waits a few seconds, stops it, waits and
publishes a new Endpoint again.
This runs as supposed, but I noticed some strange effects modifying the
servlet context path. E.g. I use
<pre>
root.addServlet(new ServletHolder(servlet), "/soap/*");
</pre>
When I start the program and I access the service wsdl under
http://localhost/soap/testService?wsdl after the first publish it works. A
second call to the wsdl after the service endpoint was stopped, created
newly and published leads to:
INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: No such operation:
So instead of the wsdl a NoSuchOperationFault is shown.
Now the very odd part:
The same procedure but this time I do _not_ call the wsdl within the first
publishing intervall. So the endpoint is published, stopped, gets created
newly, published and then I access the wsdl: it works!
Trying some time around I discovered a workaround by adding a new
ServletHolder with the old servlet to the context root before publishing the
new Endpoint again:
root.addServlet(new ServletHolder(servlet), "/soap/*");
endpoint = Endpoint.publish("/testService", service);
Now the wsdl is accessible the second time _with_ the new context path
/soap/.
1. Can anyone explain me this behavior, especially, if it is a bug or wrong
usage?
2. Is this the correct way to start and stop/republish new Endpoint or do I
have to fear old resources which do not get cleaned up?
--
View this message in context:
http://www.nabble.com/Republishing-a-service%3A-odd-behavior-tp18255362p18255362.html
Sent from the cxf-user mailing list archive at Nabble.com.