Using MessageDispatcherServlet vs wiring up Spring-WS in a DispatcherServlet
As I was going through the spring reference for Webservices, I got to know that there are two ways to implement jax-ws webservices in spring.
One is by using MessageDispatcherContext, which I found is the easiest way to go about.
And the other way is to wire Spring-ws in a DispatcherServlet using some adapters like WebServiceMessageReceiverHandlerAdapter and SimpleControllerHandlerAdapter etc.
I couldn't understand the need of this second approach as at first, it looks a bit complex to me. Please help me understand why I should use this second approach and given a scenario which approach is best suited.
The answer to this question lies in the Spring Webservices documentation itself :
The message dispatcher operates on a message context, and not transport-specific input stream and output stream.
As a result, transport specific requests need to read into a MessageContext.
For HTTP, this is done with a WebServiceMessageReceiverHandlerAdapter, which is a Spring Web HandlerInterceptor`, so that the MessageDispatcher can be wired in a standard DispatcherServlet.
You should use WebServiceMessageReceiverHandlerAdapter because in most cases the Transport is HTTP/S . However if your application serves as Service Bus like Mule - MessageDispatcher is more suited