It's not a secret anymore!*
The moose likes Web Services and the fly likes Webservices Client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Web Services
Bookmark "Webservices Client" Watch "Webservices Client" New topic
Author

Webservices Client

Shiaber Shaam
Ranch Hand

Joined: Jun 16, 2006
Posts: 252
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?

Thanks


$Hi/\bEr
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
I'd say it is based on laziness...:-)
If you want to make life simple, you use generated proxies, if not, you use dispatch.
Seriously:
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).
3. Dispatch.
Best wishes!
shivendra tripathi
Ranch Hand

Joined: Aug 26, 2008
Posts: 263
Does dispatch is same as creating stub ??


SCJP 1.5(97%) My Blog
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
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.
Best regards!
Shiaber Shaam
Ranch Hand

Joined: Jun 16, 2006
Posts: 252
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.

Thanks
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Regarding using Dispatch to send requests to web services, take a look at section 4.8 in my SCDJWS Study Notes document you can download at:
http://www.javaforum.se/jforum/posts/list/549.page
Best wishes!
 
GeeCON Prague 2014
 
subject: Webservices Client