Showing results for 
Search instead for 
Did you mean: 

List running Virtual Servers using Scala

(Originally posted Aug 19 2009)

Accessing Zeus' Control API from Scala is a relatively straightforward process. It is almost identical to the process you use for Java.

Currently the best way to access the control API is using the Apache axis library which you can obtain here . You will also need the WSDL files describing the API. To download the WSDL files go to the Zeus Admin Server then to the online help, and look for the "Zeus Control API WSDL Files" link on the 'Manuals' page. One final dependency that needs to be satisfied is that we need the javamail package, which can be found here .

Once you have downloaded and extracted these files we need to convert the WSDL files to Java code, compile them and package them up. On a Unix system you need to issue these commands,

for F in wsdl/.wsdl ; do java –cp :axis-1_4/lib/:javamail-1.4.1/lib/* \
org.apache.axis.wsdl.WSDL2Java $F ; done
mkdir obj
javac –d obj com/zeus/soap/zxtm//.java
cd obj
jar cf ZXTM-API.jar com/zeus

This will produce ZXTM-API.jar which you will need to add to your classpath. We are ready to write a Scala program to list the running Virtual Servers. This mirrors our Java example quite closely which you can look at <a href="" target=_blank>here</a>.</p>


  • import com.zeus.soap.zxtm._1_0._;

  • import;

  • import;

  • import;

  • import;

  • import;

  • import;

  • import;

  • import;

  • objectVSList{

  • def main(args:Array[String]){

  • Security.addProvider(newMyProvider)

  • Security.setProperty("ssl.TrustManagerFactory.algorithm",

  • "TrustAllCertificates")

  • val vsl =newVirtualServerLocator

  • vsl.setVirtualServerPortEndpointAddress(

  • "https://userSmiley Tongue[email protected]:9090/soap")

  • val port = vsl.getVirtualServerPort

  • val vs_names = port.getVirtualServerNames

  • val enabled_vs = port.getEnabled( vs_names )

  • for( i <-0until vs_names.length )

  • if( enabled_vs(i)) println(vs_names(i))

  • }

  • }

  • // Below is TrustManager boiler-plate

  • objectMyTrustManagerFactoryextendsTrustManagerFactorySpi{

  • overridedef engineInit(keystore:KeyStore){}

  • overridedef engineInit(mgrparams:ManagerFactoryParameters){}

  • overridedef engineGetTrustManagers ={

  • Array[TrustManager](newMyX509TrustManager)

  • }

  • }

  • classMyX509TrustManagerextends X509TrustManager {

  • overridedef checkClientTrusted(chain:Array[X509Certificate],

  • authType:String){}

  • overridedef checkServerTrusted(chain:Array[X509Certificate],

  • authType:String){}

  • overridedef getAcceptedIssuers :Array[X509Certificate]=null

  • }

  • classMyProviderextendsProvider("MyProvider",1.0,"Trust certificates"){

  • put("TrustManagerFactory.TrustAllCertificates",

  • MyTrustManagerFactory.getClass.getName )

  • }

Running the example is pretty simple, first compile it,

> scalac -classpath ZXTM-API.jar listVS.scala

then run it,

> scala -classpath ZXTM-API.jar listVS
Main website
Mail servers
Test site

Version history
Revision #:
1 of 1
Last update:
‎10-03-2011 12:44:PM
Updated by: