Create Web Service

Create Web Services using axis and eclipse

For better clarity, I will take you through one service creation and one client creation using eclipse. For simplicity I will create a simple calculator service with 4 simple service functions.

Text Box: ?	add
?	divide
?	substract
?	multiply


--------------------------------------------------------------------------------------------------------

Step 1: Create a dynamic web project.

 

File -> New -> Project ->

 

 

 

Press Finish and you have a new dynamic web project.

Step 2: Create a simple Calculator class.

package org.bpt.Services;

 

/**

?*

?* @author Boby Thomas

?*

?* Axis Service Sample.

?* Visit www.bobsindia.com

?*

?*/

 

public class Calculator {

?????

????? public double add(double arg1, double arg2){

??????????? return arg1 + arg2;

????? }

 

????? public double substract(double arg1, double arg2){

??????????? return arg1 - arg2;

????? }

?????

????? public double multiply(double arg1, double arg2){

??????????? return arg1 * arg2;

????? }

 

????? public double divide(double arg1, double arg2){

??????????? if(arg2 != 0)????

????????????????? return arg1 / arg2;

??????????? else return -1;

????? }

}

 

 
 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


Step 3: Create an axis service from this class.

Right click? Calculator.java

New -> Other -> Web Service

 

Next

 

Click on the link and select Axis 2.

 

Click OK and click Next in Web service Dialog.

 

 

 

 

Now click on Start Server and wait for few seconds.

Press Next

 

Finish. You have created a new axis service, deployed it and started the server now.

 

 


--------------------------------------------------------------------------------------------------------

TABLE OF CONTENTS

--------------------------------------------------------------------------------------------------------

Part1 : Introduction - Developing and debugging web services using axis, eclipse and Tomcat
Part2 : Create Web Services using axis and eclipse
Part3 : Check Services
Part4 : Debugging the Web Services created using eclipse
Part5 : Creating a Java Client for the web Service
Leave a comment Discuss about the topic

Related Links