How to Develop A Web Service And Client In Java (Using Eclipse- Apache Axis 2 Bottom Up Sevice)

Introduction :

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 .

Pre-requisites :

  • JDK (1.6 or above )
  • Eclipse WTP 2.0
  • Apache Tomcat Server (5.5 or above )
  • Axis 2

Downloads :

  • Download Jdk From Here (download) .
  • Download Eclipse From Here (download) .
  • Download Axis 2 From Here (download) .
  • Download Apache Tomcat From Here (download) .

Configuration :

  • 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

Pic_01

Then Click Add

Pic_02

Select The Server (Apache Tomcat V5.5 or Above ) Then Click next Pic_03

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

pic_04

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.

Pic_05

Give the project Name as Axis2Example . Set Apache tomcat as Runtime Server

Pic_06

Then Give Axis2 Web Service Facet .

Pic_07

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 .

image

The Class is as under

image

Right Click on the Class And Form it As a Web Service .

image Then Web Service Configuration Starts . select Bottom Up java Bean WebServices .

Select Tomcat Apache v6 as server .

Select Apache Axis2 as webservice Runtime Click ok.

image

click ok.

image

Click Next

image  Leave these settings as default  Press Next .

Then Start Server if not Started

image

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 .

image

Then Click Next .

image

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 .

image

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.

image

Click on the webService Concatenate to See The WSDL file. Copy that path .

image

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.

image

Click Next .

image

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 .

image

Click ok

image

The Structure of Web Server Listener is as under :

image

Now Form Java Class having Main function in order to call that service .

image

Name It ClientCall or any other Name You Want And select public Static void Main (String[] args).

Click Finish.

Then Right Click on the File and Run it as java Application .

image

4 thoughts on “How to Develop A Web Service And Client In Java (Using Eclipse- Apache Axis 2 Bottom Up Sevice)”

  1. It’s amazing to visit this web site and reading the views of all colleagues on the topic of this article, while I am also eager of getting know-how.

    Reply
  2. Whats up this is kind of of off topic but I was wanting to know if blogs use WYSIWYG editors
    or if you have to manually code with HTML. I’m starting a blog soon but have no coding knowledge so I wanted to get guidance from someone with experience. Any help would be enormously appreciated!

    Reply
  3. ok No problem if you don’t know anything about coding you just have to go for online free blogs and just start .. as long as you get experience get your own domain and start blog by your on self..

    Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.