List running Virtual Servers using Python and SOAPpy

The following code uses ZXTM's Control API to list all the running virtual servers on a cluster. The code is written in Python.


listVS.py

#!/usr/bin/python
import SOAPpy

conn = SOAPpy.WSDL.Proxy("VirtualServer.wsdl")
names = conn.getVirtualServerNames()
enabled = conn.getEnabled(names)

for i in range(0,len(names)):
   if ( enabled[i] ):
      print names[i]

Notes

By default, most SOAP implementations read the location of the SOAP server from the WSDL file (located in ZEUSHOME/zxtm/etc/wsdl. However, for security reasons, the location of the ZXTM Admin Server (including the required administrator username and password) is not embedded in the ZXTM WSDL files. Most SOAP toolkits allow you to override the location specified in the WSDL file, but Python;s SOAP.py module does not. Before you run this example, edit your WSDL files. Look for the soap:address node at the very end of each WSDL file and edit appropriately:

<service name="VirtualServer">
   <port name="VirtualServerPort"
         binding="zeusns:VirtualServerBinding">
      <soap:address location="https://username:password@host:9090/soap" />
   </port>
</service>

Running the example

This code was tested with Python 2.3.5 and version 0.11.5 of the SOAP.py library. Earlier versions of the SOAP.py library (0.8.4) could not correctly parse the WSDL file.

Run the Python script as follows:

$ listVS.py
Main website
Mail servers
Test site
Owen Garrett [Zeus Dev Team] 20 October 2005  Permalink  
Leave a comment ...
Your email address will not be displayed.
Your URL will be displayed.
This public messageboard is not a forum for technical support. To report technical support problems, please contact our dedicated Support team using the instructions at the bottom of this page.
Options:
 
(Line breaks become <br />)
(Set cookies for name, email & url)
Download Free ZXTM Desktop Edition

Recent Articles

Other Resources



www.zeus.com