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?
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.
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.