On Jan 21, 2014, at 12:39 PM, asarkar <[email protected]> wrote:

> Seems like just invoking publish() on the endpoint does the job. Should I
> really be calling publish() though - isn't that for standalone applications
> only (or for unit tests), and not for a servlet/application container?

No, if you want a “listener” connected to the Endpoint, you would need to call 
publish.   It’s at that point that the Endpoint is finally wired together with 
the listeners and such and is made available to clients.


> @Bean
>    public Endpoint calculator() {
>    EndpointImpl endpoint = new EndpointImpl(cxfBus, new Calculator());
>    endpoint.setAddress("/CalculatorService");
>               
>    // I was deliberately missing this    
>    endpoint.publish();
> 
>    return endpoint;
> }
> 
> Also, the test Andrei referred to sets the bus on the CXFServlet which seems
> to have no effect in my case. What does it do - is it necessary?
> cxfServlet.setBus(cxfBus);

Well, you need to make sure the Bus that the Servlet see’s and the bus that you 
use for the EndpointImpl are the same.   The “servlet http transport” that the 
servlet is dispatching into is registered on the bus that it sees.   If a 
different bus object sees a different HTTP transport, then the servlet wouldn’t 
be able to dispatch requests to that endpoint.


-- 
Daniel Kulp
[email protected] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Reply via email to