Debugging Web Services


webMathematica provides some nice functionality to publish web services that are driven by Mathematica. You can also debug web services on the server.

You need to include the source for the web service in the part of the project for web material, typically called WebPages. Then deploy to the server and install the service (this needs to be done after the server is running in debug mode).

Here is the source of a web service, as it might appear in the source editor.

Debug Web Service

Note the blue dot in the margin: this is a breakpoint. When the web service is executed it will hit this breakpoint and you can stop to inspect the working of the code.

If you spend too much time at the breakpoint then the webMathematica server might terminate the kernel. In this case you might want to change configuration to increase the KernelTimeLimit in the MSPConfiguration.xml file.

Locating the Code

In order for breakpoints to work it is important that you locate the code in the server and the Workbench in compatible locations.

If the code for the web service is located in the Workbench as WebPages/RandomNumber.m then this file will be deployed to webMathematica at the root of the web application. You would then access the web service through the URL http://servername/webMathematica/RandomNumber.m?wsdl (where servername is name of your server).

If you want to place the code more deeply in the web application, for example, in a folder tools, found in the web application. Then you would locate the code in the Workbench as WebPages/tools/RandomNumber.m. You would access the web service through the URL http://servername/webMathematica/tools/RandomNumber.m?wsdl.