SOAP is a messaging protocol for exchanging information based on XML over the network. SOAP messages are written in XML, which is why they are platform- and language-independent. A lot of enterprises have such webservices that return useful data for use in (web) applications.
Now, if you want your application to work, then these webservices have to work too, and sometimes it’s hard to debug the application to know which of the required webservices is not working correctly. Therefore it’s useful to monitor these webservices just as you would the application itself.
To do this I wrote a small check script which uses curl to communicate with a SOAP webservice, and then checks whether the answer for the SOAP-Request to the webservice contains certain key strings, so that you can be sure the webservice has returned the right form of data. It’s written as a nagios/icinga check plugin and also returns the amount of time the webservice needed to return the answer to our request.
Feel free to download the plugin from here.
# /neteye/shared/monitoring/plugins/check_curl_soap --help Plugin to check a SOAP Service over a SOAP Call using curl USAGE: check_curl_soap -U <URL> -P <POST-DATA|@POST-DATA-FILE> -S <SEARCH-REGEX-STRING> [-A USER:PASS] -U URL ... URL to use for the SOAP Webservice -A USER:PASS ... Authentication user name and password -P POSTDATA ... Your SOAP request XML Data, can be a String or a Filename when preceded by a @ -R REGEX ... Regex/String to search for within the returned data -D ... DEBUG
Give the command line parameters above, the required data for making a SOAP request is:
With these details in hand you can send a request, and you should then receive an answer from the SOAP webservice. Then the plugin can check if the REGEX string passed to the plugin can be found within the answer text of the webservice.
Example Postdata SOAP request:
<?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Header> <ns1:RequestHeader soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns:ns1="https://www.google.com/apis/ads/publisher/v202111"> <ns1:networkCode>123456</ns1:networkCode> <ns1:applicationName>DfpApi-Java-2.1.0-dfp_test</ns1:applicationName> </ns1:RequestHeader> </soapenv:Header> <soapenv:Body> <getAdUnitsByStatement xmlns="https://www.google.com/apis/ads/publisher/v202111"> <filterStatement> <query>WHERE parentId IS NULL LIMIT 500</query> </filterStatement> </getAdUnitsByStatement> </soapenv:Body> </soapenv:Envelope>
Now that you also have this, you can also monitor your SOAP webservices to be sure that all of your backend functions are working correctly.