1

I have a very basic web service that I think is running correctly from Eclipse. Now I want to add in connections to a DB -- so I want to step thru the code to try out JDBC connections (I'm a .NET developer working this out in java).

Here is the (very) basic code:

public class PositionSkillManagementService {
    private String t;
    public void addSkill(String s){
        t="s";    //I want to add a breakpoint here. 
    }
}

I think the webservice is working because when I go to this URL"http://localhost:8080/TrainingSystem/services/PositionSkillManagementService" I get a screen that says "Hi there, this is an AXIS service! Perhaps there will be a form for invoking the service here..."

I want to add a breakpoint in the addskill method so I can then debug connections to the db. I have added the breakpoint in eclipse and I see the little dot showing the breakpoint is set. But I don't know how to 'get' to the breakpoint? I don't know how to tell eclipse to execute the method so I can get to the breakpoint. I'm sure this is a basic question but I'm new to the environment.

What do I do?

bernie2436
  • 22,841
  • 49
  • 151
  • 244

3 Answers3

6

Complete these few steps

  • Start your Web Application Server (Tomcat, JBoss, GlassFish, etc) in debug mode.
  • Deploy the component that contains your web service (usually a Web Application).
  • Invoke your Web Service somehow, for example, using the Web Service Explorer, the application would stop in your breakpoint.
Luiggi Mendoza
  • 85,076
  • 16
  • 154
  • 332
2

This might be a bit late, but just in case.

I followed the steps from Luiggi Mendoza and worked great. The only thing, I had got the error "Source not found" and added the project to the look up path. Here are the steps I followed:

Debug Web Services & Deployed EJBs

Complete these few steps:

  • Start your Web Application Server (JBoss) in debug mode.
  • Deploy the component that contains your web service (MyTest.ear).
  • Insert a breakpoint at the line you wish in your code.
  • Invoke your Web Service somehow, for example, SoapUI, calling the REST endpoint through a browser, or using a service tester.
  • When the breakpoint hits, you will most likely get an error message in Eclipse saying Source not found.
  • Click the button Edit Source Lookup Path
  • Click the Add button in the next dialog
  • Select Project type and click OK on the next dialog.
  • Select the project(s) that have the code under investigation. Make sure you select checkbox to Add required projects if required
  • Click OK, and OK again. You debug breakpoint will hit. Stepping through the code will load the code files from the projects you selected for code lookup.
  • Follow regular Eclipse/Java debugging procedures.
Ruskin
  • 5,721
  • 4
  • 45
  • 62
Hector
  • 43
  • 5
  • Great answer !! This is the only place I could get the answer for debugging a web service call. I am using netbeans, wildfly (jboss) and SoapUI. Didn't need to redeploy the ear and didn't get the error of source not found. Used [this SO post](https://stackoverflow.com/questions/5337787/how-to-debug-jboss-application-in-netbeans) to start wildfly in debug mode as I am not using the embedded one. – sss May 01 '18 at 20:49
0

You need to go to /PositionSkillManagementService/addSkill if you're using Axis. I'd recommend using SOAPUI to parse the endpoint if you do go down the SOAP route.

As soon as that line of code gets fired and providing your server is running from debug (click this icon debug) it will fire the breakpoint when it hits it and go into debug mode so you can step over / step into the method.

David
  • 19,577
  • 28
  • 108
  • 128
  • when i go to /PositionSkillManagementService/addSkill I get "AXIS error No service is available at this URL" What does that mean? – bernie2436 Mar 25 '13 at 14:14
  • It means this method hasn't been deployed, how are you browsing to it, as @Luiggi Mendoze you can either use the web service explorer or something like SOAPUI. Are you exposing the web service using the web.xml of your application server? Are you following a specific tutorial? – David Mar 25 '13 at 14:17
  • I am browsing to it by going to the URL in my browser. I am not sure how to "expose the web service using the web.xml of my application server" – bernie2436 Mar 25 '13 at 14:28
  • @akh2103 Start your application server in debug mode from Eclipse. Then deploy the component that contains the Web Service (the web application or the EJB or whatever it is), then access to your web service. I've updated my answer. – Luiggi Mendoza Mar 25 '13 at 14:53