Skip to Content
author's profile photo Former Member
Former Member

Debug web service in NWDS?

Hi,

I am getting a nil string when I test web service, I see this in the NWDS (web services checker):

getOfficeListResponse

response

Here is my web service method:

public String[] getOfficeList(String userID){

try {

IUser user = UMFactory.getUserFactory().getUser(userID);

String[] listOfGroups = null;

int length = 0;

Iterator iterator = user.getParentGroups(true);

while(iterator.hasNext()){

listOfGroupslength = iterator.next().toString();

length++;

}

if(length == 0)

return null;

else

return listOfGroups;

} catch (UMException e) {

// TODO Auto-generated catch block

// e.printStackTrace();

return null;

}

}

Any bug in the code?

Can anybody let me know how to debug a web service method?

Thanks a lot!

Tony

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 17, 2009 at 11:25 AM

    Hi Tony,

    Have a look at the following blog:

    /people/sap.user72/blog/2004/12/17/some-handy-http-tools

    Regards.

    Rajat

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 19, 2009 at 04:41 AM

    Hi Tony,

    In your code, the problem is occuring due to the below line:

    String[] listOfGroups = null;

    As the String array is defined as a NULL object, the code in the while loop, where you assign values to this array should be throwing out an exception.

    You need to initialise the String array with some specified length. it can be done as:

    String[10] listOfGroups = {};

    Also, while doing the exception handling, you have returned NULL in case of occurrence of an exception. A better approach will be to return the exception message or stacktrace.

    Regards,

    Alka.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 19, 2009 at 05:10 AM

    When you are ready to build and run your Web service, you must first compile the ASP.NET Web Service project. Once compiled, you can run the Web service. For more information, see Debugging Preparation: ASP.NET Web Service Projects.

    You can choose from three methods to build and run your Web service:

    Method

    Description

    With the debugger

    This method starts the default browser and loads the specified start page. Running a page in the debugger makes it possible for you to step through code line-by-line and use additional analysis tools and runtime information. If Visual Studio detects that key files have changed, it will also build the project before launching the browser with the specified start page.

    Without the debugger

    This method makes it possible for you to run your code as it normally would run outside of the context of development tools, and therefore no runtime information is available through these tools. If Visual Studio detects that key files have changed, it will build the project before launching the browser with the specified start page. However, you can attach the debugger to the process as needed.

    View in browser

    This method compiles the project and opens a Web page chosen from Solution Explorer. Visual Studio compiles and runs the project in the default browser within Visual Studio.

    To build and run a Web service with the debugger

    In Solution Explorer, right-click the .asmx file for the Web service you wish to run and click Set As Start Page on the shortcut menu.

    On the Debug menu, click Start.

    This command instructs Visual Studio to run the Web service in the debugger.

    To stop running the form and return to the Code Editor, close the browser, or click Stop Debugging on the Debug menu.

    To build and run a Web service without the debugger

    In Solution Explorer, right-click the .asmx file for the Web service you wish to run and click Set As Start Page on the shortcut menu.

    On the Debug menu, click Start Without Debugging.

    Visual Studio saves all files in the project and then builds it. Once built, Visual Studio launches the default browser and navigates to the project's start page.

    To stop running the Web service and return to the Code Editor, close the browser.

    To build and run a Web service using the View in Browser option

    In Solution Explorer, right-click the .asmx file for the Web service you want to run and click View in Browser on the shortcut menu.

    Visual Studio builds the Web service and launches the specified start page within the IDE.

    To stop running the Web service and return to the Code Editor, close the browser.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 19, 2009 at 05:12 AM

    I used a program called WebServiceStudio 2.0 to debug my web

    services. You can set your breakpoints, run the debugger and then launch this

    program that will send a SOAP or HTTP request to your web service. Doing this

    will hit your breakpoints so you can debug. More information on the program

    can be found here:

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.