Getting Started with Web Services bottom up WSDL development

This tutorial will guide you how to create a new Web Services project with Bottom up approach.

You can read this earlier post If you want to read what us Bottom up and Top down web service development approach.

This tutorial will help you to get started to use

  • Eclipse WTP Tools
  • Apache Axis2 runtime
  • Create a simple webservice
  • Create simple client

The tutorial is updated version of the one present in Eclipse official website . It follows the same steps

This is a long tutorial and hence has been divided into two posts.

The list of softwares required are

  1. Eclipse J2EE ( I used Indigo) ( Download Eclipse )
  2. Apache Axis runtime( I used 1.6.0 binary distribution ) ( Download Apache Axis )
  3. Apache Tomcat ( I used 7.0.19 windows distribution) ( Download Tomcat )

Environment Setup

1. Extract all the Zip files for above 3 , just note the location of all of these three.

2. Axis Configuration :

Start Eclipse Go to Window > Preferences > Web Services > Axis2 Preferences

Browse for Axis2 folder where you extracted Axis download

Message that Axis runtime loaded successfully will be shown.

Apache Axis Eclipse Settings

 

3) Tomcat Configuration

Start Eclipse Go to Window > Preferences > Server > Runtime Environments

click Add

Browse and give path for tomcat zip where you extracted.

This will configure tomcat for eclipse.

Tomcat setup in eclipse

This completes the system environment setup part for developing new Web Service project

Creation of Project

Next we need to create a project with the support of Axis2 features. Open File -> New -> Other... -> Web -> Dynamic Web Project

Give the project name as BottomUpWebService

Select the target runtime as configured earlier

Select Dynamic web module version as 2.5

In the Configuration , select custom and click Modify

When you select Modify , a new Window Project Facets will come

Choose Apache Axis also along with Java / J2EE

Click Ok to save and exit

Eclipse Dynamic Project creation

 

Eclipse Apache Axis new project

In Project setup wizard , just click Next , Next to complete the project creation

Just write simple addition and subtraction program in src folder

package firstWebService;

public class Calculator {

int sum(int a,int b){
return a+b;
}

int subtract (int c,int d){
return c-d;
}
}

Select Calculator.java, open File -> New -> Other... -> Web Services -> Web Service

Click Next

clip_image001[1]


Click on Web Service runtime and select Apache Axis2

· The Web service wizard would be brought up with Web service type set to Bottom up Java bean Web Service with the service implementation automatically filled in. Move the service scale to Start service.

 


Bottom Uo Java Bean Web Service Eclipse


 


On the

If the server is currently stopped , it will say you to Start Server . Just click Start Server

After server has been started , just click finish

Deploy the Project

Right click on the project BottomUpWebService and select Run As > Run on Server

Select the tomcat which you configured earlier to run this project and Click Finish

Apache Axis Startup in Eclipse


The home page will open to show that Apache Axis is running

Click on services

Click on Calculator to see WSDL file of Calculator class generated

WSDL Dispay in Eclipse

 

This completes the WSDL generation

Copy the WSDL URL above , we will need this is next process

http://localhost:8080/BottomUpWebService/services/Calculator?wsdl

Now we will make Client for this project

Create a new Web Service Client project

http://jugnu-life.blogspot.com/2011/08/web-service-client-using-bottom-up.html

2 comments:

  1. for eclipse juno, i have to plugin axis2 or it is already installed

    ReplyDelete
  2. Hi,

    If its plain Eclipse Juno you need to install all of the additional plugins manually. You need stuff to develop web services in eclipse and then dowonload Apache Axis also.

    If you follow tutorial from start you should be able to do.

    Best easy wat is to download Eclipse J2EE version

    Thanks,

    ReplyDelete

Please share your views and comments below.

Thank You.