Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Webservices Client

 
Shiaber Shaam
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does dispatch is same as creating stub ??
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic