As usual, this post is to address a general issue to avoid writing too much of code. This is specifically for calling a specific web service from Java.
Now-a-days we use Web-Services like drinking water everyday :). Hence we write code to call Web-Services from Java client applications. These web services are different in nature and hence the code becomes different for each Web-Service.
What I want to present which most of you might already know is Dynamic Web-Service Façade Client Controller based out of Java and used AXIS-2 engine.
Let’s get started.
1. The basic structure of calling a Web-service via AXIS-2 is explained below where I use ServiceClient to create a handle to the webservice.
2. The main and core part is getting the Input to webservice from any XML object or any string which contains the XML request.
So this will enable you to call any web service with only two options – web service URL and the input XML.
Below is complete code for the same.
[click here to download]