I need to provide our customers a way to disable/suspend/enable monitors/devices which we watch for them. I am a big fan of crossplattform scripting so i only use PHP and Perl on Windows and Linux. ASP.NET is no option.
So far i have written the necessary scripts to read all relevant informations (groups, monitors, ids, names, etc.) with PHP using nuSoap. E.g. to get all Groups i use:
<?php
require_once('../lib/nusoap.php');
echo '<pre>';
$wsdl = "">my_ipmonitor_domainname/.../status.asmx";
$client = new soapclient($wsdl, false);
$client->setCredentials('my_account','my_password','basic');
$mysoapmsg = '<soap:Envelope xmlns:xsi="">www.w3.org/.../XMLSchema-instance" xmlns:xsd="">www.w3.org/.../XMLSchema" xmlns:soap="">schemas.xmlsoap.org/.../">
<soap:Body><GetGroups xmlns="">schemas.ipmonitor.com/.../" /></soap:Body></soap:Envelope>';
$soapaction = "">schemas.ipmonitor.com/.../GetGroups";
$result = $client->send($mysoapmsg, $soapaction);
print_r($result);
#actualy here are done some other task to store data into a hash (associative array)
echo '</pre>';
?>
The example above is now modified for other soap actions like GetMonitors or Monitorview (then using config.asmx). As i wrote reading the informations is not the problem.
The tricky part seems to be to change values of groups and monitors. support.ipmonitor.com/.../5a7bc4f48b324a96b214b46228fcb4b5.aspx explains the invoke details as follows:
<soap:Envelope xmlns:xsi="">www.w3.org/.../XMLSchema-instance" xmlns:xsd="">www.w3.org/.../XMLSchema" xmlns:soap="">schemas.xmlsoap.org/.../">
<soap:Body>
<MonitorEdit xmlns="">schemas.ipmonitor.com/.../">
<Settings>xml</Settings>
</MonitorEdit>
</soap:Body>
</soap:Envelope>
However the <Settings>xml</Settings> is not described in any way. Whatever i do the soap function MonitorEdit gives back "false". My current code is:
<?php
require_once('../lib/nusoap.php');
echo '<pre>';
$wsdl = "">my_ipmonitor_domainname/.../config.asmx";
$client = new soapclient($wsdl, false);
$client->setCredentials('my_account','my_password','basic');
$mysoapmsg = '<soap:Envelope xmlns:xsi="">www.w3.org/.../XMLSchema-instance" xmlns:xsd="">www.w3.org/.../XMLSchema" xmlns:soap="">schemas.xmlsoap.org/.../">
<soap:Body>
<MonitorEdit xmlns="">schemas.ipmonitor.com/.../">
<Settings>
<monitor>
<id>2784343672959</id>
<enabled>false</enabled>
</monitor>
</Settings>
</MonitorEdit>
</soap:Body></soap:Envelope>';
$soapaction = "">schemas.ipmonitor.com/.../MonitorEdit";
$client->setGlobalDebugLevel(9);
$result = $client->send($mysoapmsg, $soapaction);
print_r($result);
echo '</pre>';
?>
The response is:
ResultArray
(
[MonitorEditResult] => false
)
The ID used is correct (verified by checking the xml popup of the monitor in question.
The SOAP call is working otherwise i would not get the result from MonitorEditResult.
Enabled should be set to false if the customer wants to disable the monitor, otherwise to true (suspend is not available as i have read in an other post).
The account used has all rights in ipmonitor (it is the admin).
Therefore i assume it is the code between the <settings> tag. What format does ipmonitor expect 'xml' to be?
Regards
Michael