cancel
Showing results for 
Search instead for 
Did you mean: 

Tech Tip: Using the SOAP Control API with Perl

The following code uses Stingray's Control API to list all the running virtual servers on a cluster. The code is written in Perl, using the SOAP::Lite module:

 

listVS.pl

#!/usr/bin/perl -w
use SOAP::Lite 0.60;

# This is the url of the Stingray admin server
my $admin_server = 'https://usernameSmiley [email protected]:9090';

my $conn = SOAP::Lite
   -> uri('http://soap.zeus.com/zxtm/1.0/VirtualServer/')
   -> proxy("$admin_server/soap");

# Get a list of virtual servers
my $res = $conn->getVirtualServerNames();
my @names = @{$res->result};

# Establish which are enabled
$res = $conn->getEnabled( \@names );
my @enabled = @{$res->result};

# Print those which are enabled
for( my $i = 0; $i <= $#names; $i++ ) {
   if( $enabled[$i] ) {
      print "$names[$i]\n";
   }
}


Running the Example

 

$ ./listVS.pl

Main website

Mail servers

Test site

 

Notes

 

To run this example, you will need Perl, SOAP::Lite and IO:Smiley Frustratedocket:Smiley FrustratedSL. On Debian-based systems, you may install the packages libsoap-lite-perl and libio-socket-ssl-perl. On RedHat based systems, you'll need the perl-SOAP-Lite and perl-IO-Socket-SSL rpms.

 

Perl's SOAP::Lite module does not use the WSDL file to perform any type checking, so calling errors will be detected at runtime. The SSL layer is happy to accept self-signed certificates.

 

Read more

 

Version history
Revision #:
2 of 2
Last update:
‎01-13-2021 05:31:PM
Updated by:
 
Labels (1)
Contributors