About the example:
In this example we will see how to use rather consume a web service using Apache Axis2. We have a Hello World web service which is already published, it accepts a String name and prints Hello name in return. To know more about how to publish a web service, click here.
Below are the steps which shows how to consume a web service using Apache Axis2
1. Download latest version of axis2 files from http://axis.apache.org/axis2/java/core/. (i.e. axis2-1.6.2-bin.zip).
2. Extract the folder (i.e. axis2-1.6.2) in your desire location. Lets assume as C:\axis2-1.6.2.
3. Add enviroment variable AXIS2_HOME and set the value "C:\axis2-1.6.2". Also make sure that JAVA_HOME is set in enviroment variables.
4. Now you can use wsdl2java.bat file from folder "C:\axis2-1.6.2\bin" to download web service stubs. Use command prompt and go to folder C:\axis2-1.6.2\bin and run below command.
wsdl2java.bat -uri http://localhost:8080/SimpleWebservice/hellows?wsdl
Note : Provide your wsdl URL in above command, you can also use XSD file instead of wsdl URL. Here we have already published a hello world web services. To know how to publish a simple hello world web service, click here.
Please see the screen shot below.
In this example we will see how to use rather consume a web service using Apache Axis2. We have a Hello World web service which is already published, it accepts a String name and prints Hello name in return. To know more about how to publish a web service, click here.
Below are the steps which shows how to consume a web service using Apache Axis2
1. Download latest version of axis2 files from http://axis.apache.org/axis2/java/core/. (i.e. axis2-1.6.2-bin.zip).
2. Extract the folder (i.e. axis2-1.6.2) in your desire location. Lets assume as C:\axis2-1.6.2.
3. Add enviroment variable AXIS2_HOME and set the value "C:\axis2-1.6.2". Also make sure that JAVA_HOME is set in enviroment variables.
4. Now you can use wsdl2java.bat file from folder "C:\axis2-1.6.2\bin" to download web service stubs. Use command prompt and go to folder C:\axis2-1.6.2\bin and run below command.
wsdl2java.bat -uri http://localhost:8080/SimpleWebservice/hellows?wsdl
Note : Provide your wsdl URL in above command, you can also use XSD file instead of wsdl URL. Here we have already published a hello world web services. To know how to publish a simple hello world web service, click here.
Please see the screen shot below.


