How to Debug Your Axis2 Web Service in 3 Steps Using Eclipse?

Archived Content
This article is provided for historical perspective only, and may not reflect current conditions. Please refer to relevant product page for more up-to-date product information and resources.
  • By Saminda Wijeratne
  • 9 Nov, 2009

Web services have become mainstream and many create and consume Web services for their day to day operations. Every piece

of Web service we write today is not 100% perfect and has few bugs. When an issue occurs in the web service it takes

tremendous amount of time to go through the code and resolve if you don't have the perfect tools to do it.

The 3 steps are

  1. Setting up the environment
  2. Set breakpoints in the code
  3. Start the server in debug mode

The first step is to just create a Web service so that we can debug it later.

Prerequisites

Eclipse

3.4 or higher

href="http://java.sun.com/javase/downloads/index.jsp">Java

1.5 or

higher

WSO2 Web Services Application Server (WSO2 WSAS) 3.1.x
Eclipse Features

WSO2 Web Services Authoring & Testing Tools - v1.1.0

WSO2 Web Services Application Server (WSO2 WSAS) v3.1 - v1.0.0

 

 

 

 

 

 


Note: Visit the resources section of this tutorial to find out from where to download the prerequisites or click the

above links.

 

You may also download the resources for this tutorial from the resources section.

If you have done this tutorial

on creating Web services you can use the same workspace and can skip step 1.

Step 1 - Setting up the environment

Create a Web service using the following instructions

  1. Create a Dynamic web project having the WSO2 Web Services Application Server (WSO2 WSAS) facets enabled.
  2. Add a Java class which you want to expose and debug as a Web service
  3. Publish it as a Web service

(Try this

tutorial on more instructions on how to follow above instructions.)

Step 2 - Set debug breakpoints

Put some debug breakpoints in the source code in places which you want the debugging to hit.

 

Step 3 - Start WSO2 Web Services Application Server (WSO2 WSAS) in "Debug Mode"

While you are in the "Java EE" perspective click on the "Servers" view. Select WSO2 Web Services Application Server (WSO2 WSAS) which

your service is published in. Click "Start the server in debug mode" button in the "Server" view.

 

 

That's it. So basically all you have to do now is to invoke your service (We can use the "Try it" feature in WSO2 Web Services Application Server (WSO2 WSAS) to invoke the Web service) and see how eclipse brings up the debugging perspective with your favourite debugging

tools.

Eg:

Lets invoke our Web service and see. I'm going to use the "Try it" feature in WSO2 Web Services Application Server (WSO2 WSAS) to invoke our web

service

You might notice that your eclipse editor will flash in task bar and when focus will notice that it will either ask you to

switch to debugging perspective (if so click "Yes") or already in debugging perspective.

 

Lets step over to the next line and change the value of the variable area to something else (say "100").

 

and click the "Resume" button in the "Debug" view to continue the execution. Check out the result in

the "Try it" page which we invoked the Web service in the first palce.

 

Resources

  1. To download WSO2 Web Services Application Server (WSO2 WSAS) please visit href="https://wso2.com/projects/wsas/java">https://wso2.com/projects/wsas/java
  2. To download WSO2 Web Services Application Server (WSO2 WSAS) Tools please visit href="https://wso2.com/projects/tools/">https://wso2.com/projects/tools/ or use the update site URL

    http://tools.wso2.org/eclipse

Summary

With the use of WSO2 Web Services Application Server (WSO2 WSAS) Tools you can easily debug your Web service just like debugging your Java application in

eclipse.

Author

Saminda Wijeratne, Senior Software Engineer, WSO2, samindaw@wso2.com