Debugging a Windows Application Web Service Call
There are several tools available to you when debugging calls to Web Services:
-
Using the Web Client Helper View
DataFlex client-side web services have a built-in helper view (WebClientHelper.vw) to help you debug calls to web services. -
Using the Debugger to Debug Web Service Calls
You can debug the web service call using the Debugger.
Using the Web Client Helper View
- Double-click on the
cWSGreetingService1object in theCallGreetingWebServiceview to bring up its source code. At the bottom of the code, you will see the following commented code:
// phoSoapClientHelper
// Setting this property will pop up a view that provides information
// about the Soap (xml) data transfer. This can be useful in debugging.
// If you use this you must make sure you USE the test view at the top
// of your program/view by adding: Use WebClientHelper.vw // oClientWSHelper
// Set phoSoapClientHelper to oClientWSHelper
- Uncomment the last line of code, so that the result is this:
Set phoSoapClientHelper to oClientWSHelper
- At the top of the view's source code, right beneath the
Usestatements that are already in place, add the followingUsestatement:
Use WebClientHelper.vw
- After you do this, every web service request to this client will cause a helper view to be activated, showing you the web service call and the web service's response in XML.
Click on the Run button on the Studio's toolbar. The Studio will compile, then run your project.
When the application runs, select CallGreetingWebService from the View menu. Type your name into the form labeled Name, then click the Go button. You will see "Hello, {Your Name}, how are you today?" in the form labeled Result.
You will also see the web service helper view pop up:
In this helper view, you can see a lot of information about the Web Service call that was made, the information passed to the Web Service, the information returned, the status (e.g. "wssOk = Success"), and the raw XML data being sent to and returned from the Web Service.
Using the Debugger to Debug Web Service Calls
You can also use the Debugger to debug the code making the call to a Web Service. You can place breakpoints and step through your code while analyzing local variables and other information about your program. You could also open the client Web Service class package (cWSGreetingService.pkg in our example) and place breakpoints within the appropriate functions in the class.
Please see Debugging Code in Windows Applications to learn more about debugging Windows application code.
Next Step
You have just learned how to call and debug a web service from a DataFlex Windows application. Next, you will learn how to call web services in DataFlex web applications: Consuming a Web Service in a Web Application.