Chapter 7: Debugging a Service

You need to do the tutorials in this book in the order shown by the Tutorials Map.

Overview

Whichever type of service you created from your COBOL program, and whatever type of client you are invoking it from, you can use the debugging facilities provided to debug it.

The recommended approach to debugging requires no code changes. You must, however, associate your project with an enterprise server that is configured to allow debugging. This server can be on the local or a remote machine. In addition, you must make sure that the application files deployed to the server include the .idy files for the application.

When you begin debugging, Net Express presents a dialog in which you enter details of the service instance that you want to debug. It then contacts the enterprise server to register its interest in any service instance that matches these details. Having done this, it waits for the enterprise server to notify it when such a service begins.

Whenever a service is started, the enterprise server checks to see if it matches the information supplied by Net Express. If it does, the server attaches the Net Express debugger to the service.

Preparation

If Net Express and the project Mapdemo aren't open, open them now.

Configure the Enterprise Server to allow Service Debugging

  1. Start a web browser and enter the URL http://localhost:86.

    This displays the Enterprise Server Administration home page. The current status column tells you whether or not a server is started.

  2. Click the Edit button in the left hand column for ESDEMO.

    This displays a screen containing tabs that provide detailed administrative options.

  3. Check Allow Dynamic Debugging.
  4. Click OK to confirm your changes.
  5. If your server is started, please stop it.
    1. On the home page of Enterprise Server Administration, click Stop in the Current Status column for ESDEMO.

      A page is displayed asking you to confirm that you want to continue.

    2. Click OK.

      The value in Current Status changes to "Stopping" and if you have Show local console checked on the Edit Server page, the enterprise server console daemon window briefly appears indicating the progress of the processs of stopping the server. After a few seconds, click Refresh to check if the server has stopped. When the Current Status changes to "Stopped", continue to the next step.

    3. Click Start in the Current Status column for ESDEMO.

      The value in Current Status changes to "Starting" and if you have Show local console checked on the Edit Server page, the enterprise server console daemon window appears indicating the progress of the process of starting the server. After a few seconds, click Refresh to check that the server has successfully started. When the server has started, the Current Status changes to "Started". You can now move on to the next step.

Associate the Project with the Enterprise Server

  1. Click Project > Properties.
  2. Check Project uses an enterprise server.
  3. Click the Browse button.

    This displays a dialog with a dropdown list of available enterprise servers on your machine.

  4. Select ESDEMO from the drop down list and click OK to return to the Project Properties dialog.
  5. When you have finished, please click OK to confirm your changes.

Establish the Service Debugging Session

You can debug the service whether you are debugging the client or simply running it. We will debug just the service:

  1. Click Animate->Start Animating from the IDE menus.

    The dialog displayed enables you to specify the details of the service that you want to debug.

  2. If you are debugging the Web service:
    1. Click the Web Service tab.
    2. Click in the Service field, and enter the fully qualified service name. This is formed by taking the name of the service, appending a hash(#) character followed by the name of the operation that you want to debug. For example, if the service name for the web service that you deployed is http://tempuri.org/wmapserv, and the operation that we will test is Read, the fully qualified service name is http://tempuri.org/wmapserv#Read.

    If you are debugging the EJB service:

    1. Click the J2EE tab.
    2. Click in the Service field, and enter the fully qualified service name. This is formed by taking the name of the service, appending a dot(.) character followed by the name of the operation that you want to debug. For example, if the service name for the service that you deployed is JMapServ, and the operation that we will test is Read, the fully qualified service name is JMapServ.Read.
  3. Click OK.

    Net Express now passes the service details to the enterprise server and waits for the service to start.

Start the Service

You can now start the deployed service by using one of the client programs that you generated earlier.

If you are debugging the Web service, use the Generated COBOL Client for Web services:

  1. In Windows, click Start > Programs > Accessories > Windows Explorer.
  2. In Windows Explorer, navigate to Examples\Net Express IDE\MapDemo\Debug.
  3. Right click wmapserv-app.int.
  4. From the popup menu, click Run with Net Express.
  5. Enter data as required, making sure to select the operation that you chose to debug in the section Establish the Debug Session. For example, select a Read operation, leave the title and author blank, and enter 1111 for the stock number.

If you are debugging the EJB service, use the JSP client for EJB:

  1. Start WebLogic Server or WebSphere Server from the Start menu as you did in the chapter JSP Client for EJB. You do not need to start the WebLogic Server Console or the WebSphere Administrative Console.
  2. When the server has successfully started, open another browser.
  3. For WebLogic, enter the URL http://localhost:7001/JMapServ/JMapServMain.jsp.

    For WebSphere, enter the URL http://localhost:9080/JMapServ/JMapServMain.jsp.

  4. Use the client to start the service, making sure to select the operation that you chose to debug in the section Establish the Debug Session. For example:
    1. Click the link for the Read operation.
    2. In the read_lnk_b_details_lnk_b_stockno field type 1111 and click Go.

Debug the Service

You now return to your debugging session. If the Net Express IDE for your debugging session is minimized, restore it.

The IDE opens, displaying book.cbl ready for debugging.

  1. You can now single-step through book.cbl.
  2. When debugging reaches the exit program statement and no line is highlighted, the service has exited and has returned to the client.

    The IDE debugger now waits for the service to start again.

    You may find that the Web service client has returned error 0015. This is a time-out, and is simply caused by the time you took in debugging. If you find this a problem, you can change the time-out interval - edit the file mfclient.dat in Net Express\Base\bin and insert:

    [default]
    timeout=nn 

    where nn is the desired timeout period in seconds (at run time the figure is rounded up to a multiple of 5).

  3. Complete the run of the client.
  4. If you want to debug the service again, repeat the steps in the sections Start the Service and Debug the Service.
  5. When you have finished debugging, click Animate > Stop from the IDE menus.

Before Continuing...

This is the end of this path through the tutorials. To continue to another tutorial, go to the topic Tutorials and Demos.


Copyright © 2006 Micro Focus (IP) Ltd. All rights reserved.