cancel
Showing results for 
Search instead for 
Did you mean: 

How to debug servlet doPost() method from NWDS

former_member208581
Participant
0 Kudos

Hi folks,

at the moment I'm working on a web application based on servlet. As the request can be pretty large, we have to use the HTTP POST method. Unfortunately I could find a way to debug it.

The NWDS 7.11 is connected to the Java AS which runs in debugging mode.

But a call from my test tool HTTP4e doesn't stop at the servlet method ... Is there anything special to be submit in the URL string or the HEADER of the HTTP request??

Looking forward to your help.

Thanks,

Axel

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

First verify if Debug mode is enabled from server side :

Open J2EE view in NWDS....and click on server node...and verify if Debug mode is ON.

Put breakpoint on your application...

Now from Run -> Debug...

Select J2EE Application...or Remote Java Application if working on remote server....

Select Project...And enter Depug Host and Debug Port.....these details you will get from your server....

Click on Debug...

Check there should be a "Right click sign" on your breakpoints......

Now access the web application from browser......

It should stop at your breakpooint.....NO URL parameters are to be entered..........

former_member208581
Participant
0 Kudos

Saurabh,

well, this approach works for the HTTP GET method which is handled by the servlet doGet() method. But using the same approach doesn't work for Post methods for some reason.

Also keep in mind that a request send from the browser to the web application is usually a GET request.

Some more ideas?

Former Member
0 Kudos

The HTTP POST requests are usually only fired by a <form> whose method attribute is set to post...

doGet is called byDefault....

Axel....Below will just cross check that your doPost method is getting called or not.....or still doGet is getting called....

Put some code in your doGet method also and the set debugger there as well......and check if debugger stops there....

Now in your doGet call the doPost method....and then debug.......

i.e. From doGet call below method...

doPost(request, response);

But use it only to check if control is getting to dopost or not.....while you debug.....

Edited by: Saurabh Agarwal on Jun 29, 2011 8:45 AM

former_member208581
Participant
0 Kudos

The client application in this scenario is not a browser, moreover application is calling the servlet to exchange data by sending a request with all required parameters in the post request.

At the end this will be handled by doPost(). It's running fine, but I'm not able to debug it so far.

Your suggestion to utilize doGet for this purpose is not the best idea as there are some obstacles based on the HTTP protocol definition.

Former Member
0 Kudos

As far as I know ....thre is no special settoing in NWDS to specify that the request is coming from doPost or doGet....it is the request that decides wether is will execute doGet or doPost.....and breakpoint if is set on doget or dopost gets activated......

Anyways to make urself sure enough that there are no such settings in NWDS you can go through below document....

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/57a09d90-0201-0010-9dab-a716ed1f7...