05 - Web Service example in Java

For the example in this tutorial we will be using Eclipse Kepler for Java EE and Axis2 for development and as a web server we will be using Tomcat 7.

We start by downloading Eclipse Kepler from: http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/keplersr2

Once we have Eclipse, we can download Axis2 1.6.2 from http://axis.apache.org/axis2/java/core/download.cgi and extract it in any folder, for instance: D:\tutorial\WebServices\axis2-1.6.2

The last thing we need now is a web server, we can use Tomcat 7, you can download it from: http://tomcat.apache.org/download-70.cgi and extract it in any folder, for instance: D:\tutorial\WebServices\apache-tomcat-7.0.52

Let’s open Eclipse and let’s configure Axis2, in Eclipse go to: Window/Preference

In the Preferences window, select WebServices / Axis2 preferences and select the runtime for Axis2 and click OK.

          

Once we have Axis2 configured, let’s create a new Dynamic Web Project:

          

Select a name for the project; in our case we will use the name: WebServiceDemo.

          

Now that we have set up our web service project name, let’s create a new runtime by clicking on New Runtime

On the New Server Runtime Environment window, select Apache Tomcat 7 and click Next.

          

In the following screen browse to where you have unzipped “Apache Tomcat 7” and click Finish. For instance: D:\tutorial\WebService\apache-tomcat-7.0.52

Now, select a Dynamic web module version 2.5 from the dropdown list.

Now, we will make some configuration changes, so click on Modify button.

In the Project Facets select Axis2 Web Services and mark Core and Extensions, click on Save As, and set a name for this Configuration, something like “Axis 2 Configuration” and click OK.

          

In the Dynamic Web Project you should have a setup like the following. 

          

Now click Finish.

Like us on Facebook