The Purpose of this tutorial is to Demonstrate the New introduced Web Axis2 Web service Tool using WTP 2.0 Driver .This tutorial will show how to develop a simple Web Service and Web Service Client Using JAVA . We Create A simple Web Service Containing Java Class Which Concatenate two Input String Value .
- JDK (1.6 or above )
- Eclipse WTP 2.0
- Apache Tomcat Server (5.5 or above )
- Axis 2
- Download Jdk From Here (download) .
- Download Eclipse From Here (download) .
- Download Axis 2 From Here (download) .
- Download Apache Tomcat From Here (download) .
- Install JDK and Set Environmental Variable Path .
- Download Eclipse .
- Download Axis2 and Unzip it In a folder You like.
- Download Apache Tomcat Server And Unzip It .
Configure Environmental Variable :
In Windows Xp go to MyComputer –> Properties –>Advanced –> Environmentalvariable Add System Variable . Give the PAth of the Bin Folder Where install Jdk .
Check this By opening Command Prompt and type Javac . If you get Error then You Miss Some Installation Step or You did’t Set Up environment Variable Correctly .
After Successfull setting of Environmental variable Run Eclipse And Set first Apache Tomcat Server .
Configure Apache Tomcat Server :
Open Eclipse And goto Windows –> Preferences –> Servers
Then Click Add
Now Give The Path of the directory where You Unzip the Apache Tomcat server or Click the download and Install Tomcat . Set JRE Path .
After Configuration Of Server Configure Axis2
Configure Axis2 :
Download Axis2 And Unzip It in a Folder You like .
Open Eclipse goto Window –> Preferences –.> webServices –> Axis2Preferences
Now give the Path of the Bin Directory of Axis2.
Web Service :
Open Eclipse And Form Dynamic Web Project File –> New –> other –> Web –> Dynamic Web Project.
Give the project Name as Axis2Example . Set Apache tomcat as Runtime Server
Then Give Axis2 Web Service Facet .
Then form a Package Name it as com.classes Add java Class in This Package Name as Concatenate.java
The Project Structure Look Like This .
The Class is as under
Right Click on the Class And Form it As a Web Service .
Select Tomcat Apache v6 as server .
Select Apache Axis2 as webservice Runtime Click ok.
Then Start Server if not Started
Then after Server Starts Click next.
After that Right Click on the project and run it as Run on server .
Then Select Apache Tomcat v6 as Server .
Then Click Next .
Your Project Axis2Example must be on the right side then Click finish.
The server Will deploy Your Application as a Web service and this is the main page of your service .
Then click on the Services To see The available Services .
In This tutorial We only Form one Service Class Name Concatenate and its service as ConcatenateString.
Click on the webService Concatenate to See The WSDL file. Copy that path .
We successfully Create and Deploy the Web Service Now we are going to form the Web Service Client To call The Web Service .
Web Service Client :
Go to File –> New –> Other –> select new web server Client.
Click Next .
paste the URL of wsdl file here in the Service Definition .
Select Tomcat V6 as Runtime Server and Apache axis2 as Web service runtime.
Select New Dynamic Name as WebServiceListener Project as Client Project .
The Structure of Web Server Listener is as under :
Now Form Java Class having Main function in order to call that service .
Name It ClientCall or any other Name You Want And select public Static void Main (String args).
Then Right Click on the File and Run it as java Application .