Debugging services with the EGL debugger

You can debug your local EGL services similarly to the way that you debug other programs.

Prerequisites

You will need an EGL Service part, as well as a requester that has binding information for accessing the service.

Debugging a local service

The simplest way to debug a service is to call it from a program in the same project as the service. You can then pass test values to the service and inspect the results.

Perform the following steps:
  1. Create a new EGL source program.
  2. In the program, declare a service variable that is based on the Service part that you want to test.
  3. Create a service client binding in the deployment descriptor as an EGL service (not a Web service) with a "local" protocol.
  4. Using the service client binding, bind the variable to the service with {@BindService{bindingKey = "ServiceClientBindingName"}}.
  5. In the main() function of the program, make at least one call to the service using that variable. The easiest way is to hard code the input values in the service call and write the output values to the console, as in the following example:
    program addTestProgram type BasicProgram 	 	
    
    myAddingMachine additionService 
       {@BindService {bindingKey = "additionService"}};
    
       function main()
          sumint int;
          sumint = myAddingMachine.addInts(5, 12);
          SysLib.writeStdOut("result = " + sumint);
       end
    end
  6. Set a breakpoint at the service call. See Using breakpoints in the EGL debugger.
  7. Set breakpoints in the service, as you would in any logic part.
  8. Debug your new EGL source program. At the breakpoint before the service call, step into the service code. The debugger pauses at the breakpoints in the service just as in any other logic part.

Feedback