Create Java SOAP Web Service Using Eclipse

In this tutorial I will teach you the simplest way to create Java SOAP web service using Eclipse IDE.

I have created this example using Eclipse Kepler. I am sure it will work with any other Eclipse version. But make sure your IDE contains Apache Tomcat and Apache Axis.

Apache Axis will do the work of creating web service using Java source file and Apache Tomcat server will be used to run and test the web service.

So without wasting any time lets begin the process.

Create Java SOAP Web Service Using Eclipse

Create Java SOAP Web Service Using Eclipse

1. First of all open Eclipse and go to File > New > Dynamic Web Project

AJAX with JSP Using jQuery Example

 

2. Give a project name and then click on Finish button to create a dynamic web project.

Create Java SOAP Web Service Using Eclipse 1

 

3. Now create a Java class inside src folder in com package. You can choose the package and class name according to you.

Create Java SOAP Web Service Using Eclipse 2

Create Java SOAP Web Service Using Eclipse 3

 

4. For demonstration purpose I am creating a function in our class that will take two numbers and return sum of these two numbers. Add following code in your class. You can create more functions according to your requirement.

 

5. Right click on Java class and go to Web Services > Create Web Service.

Create Java SOAP Web Service Using Eclipse 4

 

6. Select all the settings as given in below screenshot. Finally click on Finish button to create the web service.

Create Java SOAP Web Service Using Eclipse 5

 

7. After the web service is created a browser will be opened. Here we have to test our web service is working properly or not.

Create Java SOAP Web Service Using Eclipse 6

 

8. Under Methods you can see all the methods that we have in our class. In this case we have only one method func(). Click on it, now enter values of arguments a and b in the text boxes provided. Finally click on Invoke button to invoke the method. You can see the result of the method under Result.

Create Java SOAP Web Service Using Eclipse 7

 

9. A WSDL file is created in SOAP web service. It contains all the details of the web service. Like name of methods, name of arguments, return type, etc. You can see the WSDL file by going to folder WebContent > wsdl.

Create Java SOAP Web Service Using Eclipse 8

 

10. In our case the WSDL file will look like this.

 

Watch Video Tutorial

So, this was the simplest way to create Java SOAP web service using eclipse. Comment below if you are facing any problem. I will try my best to help you.

One thought on “Create Java SOAP Web Service Using Eclipse

  1. Srinu

    I am New Joined as a Dotnet Developer.I want to Learn MVC Programming..Please help regarding …MVC..

    Thanks in Advance;

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *