How to Debug Your Axis2 Web Service in 3 Steps Using Eclipse?
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
- Setting up the environment
- Set breakpoints in the code
- Start the server in debug mode
The first step is to just create a Web service so that we can debug it later.
|3.4 or higher|
|WSO2 Web Services Application Server (WSO2 WSAS)||3.1.x|
Note: Visit the resources section of this tutorial to find out from where to download the prerequisites or click the
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
- Create a Dynamic web project having the WSO2 Web Services Application Server (WSO2 WSAS) facets enabled.
- Add a Java class which you want to expose and debug as a Web service
- Publish it as a Web service
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
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
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.
- To download WSO2 Web Services Application Server (WSO2 WSAS) please visit href="https://wso2.org/projects/wsas/java">https://wso2.org/projects/wsas/java
- To download WSO2 Web Services Application Server (WSO2 WSAS) Tools please visit href="https://wso2.org/projects/tools/">https://wso2.org/projects/tools/ or use the update site URL
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
Saminda Wijeratne, Senior Software Engineer, WSO2, [email protected]