Accessing ZXTM’s Control API from Java

ZXTM’s Control API is a SOAP-based API that is published as a collection of WSDL files.

If you want to access ZXTM’s Control API from Java (for example, in a Java Extension), you will need to create an interface library. This interface library will expose a collection of Java classes and methods that correspond to the methods and structures in the WSDL specification.

Creating ZXTM-API.jar

We'll create a Java archive called ZXTM-API.jar to contain the interface library.

This example uses the WSDL-to-Java converter in the Apache axis project to build the interface library. This process is a little involved; you can download a precompiled ZXTM-API.jar instead and skip the rest of this section.

The process assumes that you’ve downloaded and installed the Java JDK and added it to your path.

Windows

The following command line instructions describe how to create the ZXTM-API.jar file on a Windows system; see below for a Linux/Unix system:

  1. Download the WSDL files from the ZXTM Admin Server: go to the online help, and look for the "ZXTM Control API WSDL Files" link on the 'Manuals' page:

  2. Download Apache axis; in this example, we used Axis 1.4.

  3. Download the javamail package; in this example, we used version 1.4.1.

  4. Extract each zip archive into one directory, so you have three subdirectories – wsdl, axis-1_4 and javamail-1.4.1:

  5. Run the WSDL2Java application in Apache axis directory to process each wsdl file and create the Java source files:

    for %F in (wsdl\*.wsdl) do javacp ;axis-1_4\lib\*;javamail-1.4.1\lib\* org.apache.axis.wsdl.WSDL2Java %F

    This will create a subdirectory called 'com' containing the source files for the interface library.

  6. Compile these into class files in an obj directory:

    mkdir obj
    javacd obj com\zeus\soap\zxtm\_1_0\*.java
    javacd obj com\zeus\soap\zxtm\_1_1\*.java
  7. Create the ZXTM-API.jar file from the compiled class files:

    cd obj
    jar cf ZXTM-API.jar com\zeus

Linux / Unix

Follow the instructions above, but use the following commands:

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

Using the ZXTM-API.jar interface library

From an application:

When you create an application that uses ZXTM’s Control API, you will need to add ZXTM-API.jar to your CLASSPATH. The ZXTM-API.jar file has a large number of dependencies; it depends on jar files from the Apache Axis, Javamail and the Java Activation Framework packages. Install these jar package files in your third-party Java library location, such as /usr/share/java.

From a Java Extension:

If you create a Java Extension that uses ZXTM's Control API, the easiest way to manage the ZXTM-API.jar file and its dependencies is to upload them via the ZXTM Admin Interface. The following jar files from the Axis, Javamail and JAF packages are required to use ZXTM-API.jar:

  • axis-1_4/lib/axis-ant.jar
  • axis-1_4/lib/axis.jar
  • axis-1_4/lib/commons-discovery-0.2.jar
  • axis-1_4/lib/commons-logging-1.0.4.jar
  • axis-1_4/lib/jaxrpc.jar
  • axis-1_4/lib/saaj.jar
  • axis-1_4/lib/wsdl4j-1.5.1.jar
  • javamail-1.4.1/mail.jar
  • jaf-1.0.2/activation.jar


ZXTM-API.jar and dependencies uploaded to the ZXTM Admin Interface

Note that the axis.jar Jar file is listed in the 'Java Extensions' list; this is because it happens to contain a class that inherits from GenericServlet.

More information

The ZXTM Control API manual describes how to access ZXTM's Control API through a variety of methods, including additional details on using the ZXTM-API.jar Interface Library created using Apache axis.

Why is this useful?

Take a look at the ZXTM ServerStatus article for one use of the ZXTM-API.jar library.

Owen Garrett [Zeus Dev Team] 25 September 2008 Bookmark with del.icio.us Post this article to Digg Post this article to reddit Post this article to Facebook Tweet this article 1 comment  

Comments:

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.

Comment from: Owen Garrett [Zeus Dev Team]
To create the Javadoc from the generated .java files, do the following:
mkdir javadoc
javadoc -d javadoc -subpackages com.zeus.soap.zxtm
Here is a copy: ZXTM-API.javadoc.zip.
Permalink 20 March 2009 @ 17:04
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)

Recently...

Other Resources