Thursday, April 1, 2010

Debugging WebServices (under Weblogic enviroment) using Eclipse and Soap UI

Debugging WebServices using Eclipse and Soap UI:

Webservice Developers usually develop a webservice. Then for unit testing they usually prefer following approaches:
1. Creating a main/ test class which calls that service method(this service method would be the one called by the web method).
2. Testing using Soap UI.
Usually the webservices are having very less business implementation. And Hence, the input and output parameters are very less. So, there was not much need to do a line-by-line debug in webservices.

But recently, I got a chance to work on a webservice which has more than 50 parameters and accessing lot of business method inside it. Hence If I do an unit testing with SOAP UI for every small change it ate lot of my time.

So, I got a question in my mind "Why cant we do a line-by-line debug in a webservice." Once i give an hit from Soap UI it should stop in the first break point of my code and i should run through line by line to see how the values are changing in business methods.
But when i tried in Google i got only less results that too not matching to my requirement. Later in Some forums i got some suggestions related to a web-appplication debugging.

Finally, the following change attained the goal.

  1. First check whether you are deploying the application in ManageServers
  2. Then Open StartManagedWeblogic.sh.
  3. Add the following line after the last "set " of JAVA_OPTIONS.
    set JAVA_OPTIONS=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8003 -DMS1.debug=true -Djava.compiler=NONE %JAVA_OPTIONS%

The only important thing you should note here is the 'address' and 'debug' parameter.

set the address = A port in the running server which is not in use

set the debug to true with the manage server name appended as

"-D.debug = true"

No comments:

Post a Comment