vADC Docs

Tech Tip: Using the SOAP Control API with Python

by on ‎02-25-2013 07:37 AM (1,362 Views)

The following code uses Stingray's Control API to list all the running virtual servers on a cluster. The code is written in 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 ):

      print names

Running the example

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

Run the Python script as follows:


Main website

Mail servers

Test site


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 Stingray Admin Server (including the required administrator username and password) is not embedded in the Stingray WSDL files. Most SOAP toolkits allow you to override the location specified in the WSDL file, but Python's 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"


      <soap:address location="https://username:password@host:9090/soap" />



Alternatively, you can programmatically control the endpoints as follows:

endpoint_uri = "https://username:password@host:9090/soap"

conn = SOAPpy.WSDL.Proxy("VirtualServer.wsdl")

for method in conn.methods.keys():

conn.methods[method].location = endpoint_uri

Read more