Saturday, December 8, 2012

Create java web service in Eclipse using Axis2 (Part 01)

This series of tutorials will explain how to create a simple java web service in Eclipse using Axis2. Finally I hope to create a client program for the web service.
This is the part 01.
Here I'm going to explain how we can configure Tomcat 7 for Eclipse 4.2 (Juno) because before create a java web service we need to setup development environment and configure the server. Here I use Tomcat 7 server for this tutorial.

1. Setup the development environment.
To setup the development environment you need to download and extract Eclipse EE and Tomcat servlet container.
1. Eclipse IDE for Java EE Developers - Download
2. Apache  Tomcat (Download zip archive not the windows service installer) - Download.

2. Here is the steps to configure Tomcat 7 in eclipse
2.1 Double click to open Eclipse. You should be able to see the Servers tab.

If you can't see the Servers tab then ;

 Window >> Show View and select Servers

2.2 Right click on Servers tab
Select ; New >> Server


Then from the new server window select ; Apache >> Tomcat v7.0 Server and click next 

In next window browse to extracted Tomcat files, that is Tomcat installation directory and select the jre that installed in your system and click finish to create the new server.

2.3 To start the server right click on Tomcatv7 server in Servers tab and select Start.

2.4 To check the server open Chrome and go to localhost:8080 you should be able to see Tomcat start page.

If you are getting "requested resource is not available" error you need to change the file location of the Tomcat.

In order to do that right click on server in the Servers tab and select properties. Then from the server properties window click Switch Location and Apply , OK.

Next double click on the server to open Overview.

 In the Overview window  change Server locations to Use Tomcat installation and save changes. (If you want you can change ports from the Overview window).

Restart the server and check. Now you should be able to see the default start page.

To open Eclipse Internal web browser select ;
Window >> Show View >> Other >> General >> Internal web Browser 


PART 02 (Configuration of Axis2 and creating simple web service)

Post your ideas.


  1. i am unable to modify the server loactions to use to tomcat locations as it is not active y so. waiting for ur response

  2. i am getting a resource not found error so i done as u stated,but my server location is not active so i cant change it to tomcat installation directory,waiting for ur response.

  3. can u tell me how to run java service on my websites cpanel hosting .