Webservice setup and overview
Samples
Sample request from a Linux client using perl
Sample script (test.pl) #!/usr/bin/perl -w use SOAP::Lite; # + qw/ trace /; my $soap = SOAP::Lite -> uri('urn:lvs') -> proxy('http://ws.mylvs.foo/cgi-bin/lvs.cgi'); my $result = $soap->WHATISMYIP (); unless ($result->fault) { print $result->result(); } else { print join ', ', $result->faultcode, $result->faultstring; } Sample script (test.pl) root@myLVS-LinuxClient:/usr/local/dev/mylvs# perl test.pl 200 192.168.2.222 |
|
Sample request from a Windows client using perl
To install the ActiveState Perl Module use: C:\Users\Administrator\Documents\lvs> ppm install Soap-Lite Sample script (test.pl): #!/usr/bin/perl -w use SOAP::Lite; # + qw/ trace /; my $soap = SOAP::Lite -> uri('urn:lvs') -> proxy('http://ws.mylvs.foo/cgi-bin/lvs.cgi'); my $result = $soap->WHATISMYIP (); unless ($result->fault) { print $result->result(); } else { print join ', ', $result->faultcode, $result->faultstring; } Sample script (test.pl): C:\Users\Administrator\Documents\lvs>perl test.pl 200 192.168.2.221 |
|
Sample request from a Windows client using cscript with MSXML
Set xmlReq = CreateObject("MSXML2.DOMDocument.6.0") request="<SOAP-ENV:Envelope xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance' " request = request & "xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' " request = request & "xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' " request = request & "xmlns:xsd='http://www.w3.org/1999/XMLSchema' " request = request & "SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'>" request = request & "<SOAP-ENV:Body><mylvs:WHATISMYIP xmlns:mylvs='urn:lvs'/>" 'request = request & "<c-gensym3 xsi:type='xsd:string'>192.168.xx.yy</c-gensym3>" 'alternative param request = request & "</SOAP-ENV:Body></SOAP-ENV:Envelope>" xmlReq.loadXML request 'load our request Set xmlRes = CreateObject("MSXML2.XMLHTTP.6.0") xmlRes.open "POST", "http://ws.mylvs.foo/cgi-bin/lvs.cgi" xmlRes.send (xmlReq) while xmlRes.readyState <> 4 wend Set objDispatch = xmlRes.responseXML set xmlDoc = CreateObject("MSXML2.DOMDocument") xmlDoc.Load objDispatch WScript.Echo xmlDoc.selectSingleNode("//WHATISMYIPResponse").text Sample script (test.vbs): C:\Users\Administrator\Documents\lvs>cscript test.vbs //Nologo 200 192.168.2.221 |
|
Sample request from a Windows client using cscript with SoapLite
Soaplite is a smart way to handle our request. It still runs as 32bit application on Server2012
Soaplite must be registered with the 32bit part of regsvr: C:\Users\Administrator\Documents\lvs>c:\Windows\SysWOW64\regsvr32.exe Lite.dll Sample script (test-lite.vbs): strSoapProxy="http://ws.mylvs.foo/cgi-bin/lvs.cgi" strSoapURI = "urn:lvs" set wso = CreateObject("SOAP.Lite").new("proxy", strSoapProxy, "uri",strSoapURI ) 'wscript.echo wso.WHATISMYIP(strBLA).result 'Sample for an alternative parameter wscript.echo wso.WHATISMYIP().result Sample script (test-lite.vbs): C:\Users\Administrator\Documents\lvs>c:\Windows\SysWOW64\cscript.exe test-lite.vbs //nologo 200 192.168.2.221 |
|
Requirements and functions
The above samples are required to be setup additional mySQL data, see more details here:
- The LVS-WFE Webservice offers the following functions:
Function | Optional Paramter | Description | Return |
---|---|---|---|
REQUESTWEIGHTDOWN | String (a ip address like 192.168.1.1) | Request to set the host offline | String (Code(d{3}) Description |
REQUESTWEIGHTUP | String (a ip address like 192.168.1.1) | Request to set the host online | String (Code(d{3}) Description |
REQUESTWEIGHTSTATUS | String (a ip address like 192.168.1.1) | Request the current status | String (Code(d{3}) Description |
REQUESTGROUPINFORMATION | String (a ip address like 192.168.1.1) | Request the current group configuration | String (Code(d{3}) Description |
WHATISMYIP | - | - | - |
Return Codes
- The LVS-WFE Webservice retruns the following codes:
- Log Categories
- 2nn = Success
- 3nn = Logical Errors
- 4nn = Functional Errors
- 5nn = Access or Request Errors
Code | Description | Return |
---|---|---|
200 | Request accepted (function defined message) | True |
300 | WeigthDown in process | False |
301 | TurnOff in process | False |
302 | Another maintenance service is already running | False |
304 | Host has already maintenance running, please come back later | False |
305 | Host has already ip renew set, please come back later | False |
306 | Host has already ip renewed a few minutes ago, please come back later | False |
307 | Host not found in inventory | False |
407 | IP renew is not set (debugging only) | False |
408 | Function not supported (debugging only) | False |
500 | Access denied or Request Refused | False |
501 | Access denied - update failed, contact IT-Admin | False |
- Note: The webservice requires mylvsmon to run