How to monitor a Web Service

From WebWatchBotWiki
Jump to: navigation, search
 Share 

Summary

Monitoring a web service is possible with WebWatchBot and can be done as long as your web service will accept XML submitted with the HTTP POST method, SOAP 1.1 or SOAP 1.2.

Most web services, including Microsoft's ASP.NET 1.0, 1.1, and 2.0 support POSTing of XML to a web service via the HTTP protocol, thus allowing WebWatchBot to monitor its web services. This article walks through monitoring a web service with the HTTP protocol.


Identify a Web Service Method to Monitor

For this example, consider a web method named "InputString" that accepts a text string and outputs the same text string as a response: Web services are web pages that contain one or more "web methods" that accept input and return output.
InputString-web-method.png

(Example of an ASP.NET 2.0 web service's web method)

In this examples test page, when the text "hello world" is entered and the "Invoke" button is clicked, the following output is generated:
InputString-web-method-output.png

(Example output when the web method "InputString" is invoked)

Create a Watch Item

To monitor the example web method "InputString", a Watch Item should be created of type "HTTP":

  • In WebWatchBot Manager, create a new Watch Item: File -> New -> Watch Item
  • Change the type ot "HTTP"
  • Enter the URL of the web service, e.g. http://localhost/WebService/Service.asmx
  • Click the "Settings" button
  • Select the "Form" tab
  • Change the method to "POST"
  • In the "POST Data" field, enter the XML to be posted
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<InputString xmlns="http://tempuri.org/">
<sInput>string</sInput>
</InputString>
</soap:Body>
</soap:Envelope>
  • In the "Header" field, enter:
Content-Type: text/xml; charset=utf-8
  • NOTE: If you receive the error message: "soap:Client Unable to handle request without a valid action parameter. Please supply a valid soap action."

You should add the header line: SOAPAction: "url" Where the url (in quotes) is the URL to the web method you want to invoke. watch-item-form-settings.png

  • Optional: Search output for expected text:
  1. Select the "Search" tab
  2. Enter search text, e.g. "string"
  3. When the Watch Item runs, the output will be searched for the text "string". If it is not found, the Watch Item will fail.

watch-item-search-settings.png

  • Click OK to save and close the Settings window.
  • Click OK to create the Watch Item.
  • Run the Watch Item: Click the "Run Now" button on the toolbar
  • In the Preview Pane, select the log tab, and check the output for success.