While calling a WS, we use different ways. At times, we call the WS with the request XML (generic call method) and at times we do a method call. And i hope there are other methods too. On what basis, the way to call a WS is decided?
I'd say it is based on laziness...:-)
If you want to make life simple, you use generated proxies, if not, you use dispatch.
For instance, if you need to add headers to SOAP messages and choose not to do this in a handler, you need to do that after having created the SOAP message but before sending the message.
Dispatch also allows for sending raw XML that is not SOAP and perhaps even JSON, something that would be useful if you are interacting with a RESTful web service.
As far as I know, there are three ways to send web service requests with JAX-WS:
1. Generated proxies.
2. Dynamic proxies (using Service and a endpoint interface to create a proxy, without having any generated artifacts).
It depends on from where you look at it:
- If you look at it from the server's point of view, then it does not matter. Requests are identical (hopefully) regardless of whether issued by a client using dispatch or generated stubs.
- If you look at it from the client programmer's point of view, then dispatch means more work.
- If you look at the client code, then dispatch and generated stubs look quite different.
Joined: Jun 16, 2006
Can you please more about dispath method? I want to know the implementation details in a high level.
can you also elaborate on the three ways that are quoted in this thread.