Meaningless Drivel is fun!*
The moose likes Web Services and the fly likes Generic Client To Invoke Different Webservices Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Generic Client To Invoke Different Webservices" Watch "Generic Client To Invoke Different Webservices" New topic
Author

Generic Client To Invoke Different Webservices

Samuel Jason
Greenhorn

Joined: Jun 26, 2011
Posts: 10
Hello Friends,

I am newbie to the world of webservices and have been learning through various tutorials online.
I understand that provided a WSDL, you can generate client stub using AXIS2 - say XML beans method. (It generates lots and lots of classes and I don't like that so many of them integrated into my application code)

My Question: Can we have a generic java client which could invoke any webservice ? Say we provide service details(like endpoint URL), Header elements, Body elements - as arguments to a method in the generic java client. All the client does is build soap message using the input parameters and invoke the webservice and pass back the response.

I am working on an application which is supposed to invoke several synchronous soap based webservices. I am trying to understand if I can build a common re-usable client for all the webservices instead of generating hundreds of java files for each of them using AXIS2- XMLBeans method.

Appreciate any ideas/suggestions around this?
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
Well, I suppose it is possible, but what would be the advantage?

You would end up having to find some way to tell this generic client what to do with the received SOAP response. Given the huge variety of possible SOAP services that would get quite as complicated as writing custom code in Java.

Of course, if you are accessing RESTful services it would be somewhat simpler.

Bill
Samuel Jason
Greenhorn

Joined: Jun 26, 2011
Posts: 10
William Brogden wrote:Well, I suppose it is possible, but what would be the advantage?

Could you point me to some sample code as to how I can write a generic client.

You would end up having to find some way to tell this generic client what to do with the received SOAP response. Given the huge variety of possible SOAP services that would get quite as complicated as writing custom code in Java. [/quote wrote:
This generic client code will simply pass back the soap response to the calling method. It will not process Soap response messages.

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Generic Client To Invoke Different Webservices