Stingray’s SOAP Control API is published as a collection of WSDL files. If you want to access the 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 Stingray's WSDL specification.
We'll create a Java archive called Stingray-API.jar to contain the interface library.
This example uses the WSDL-to-Java converter in the Apache axis project (version 1.4) to build the interface library. This process is a little involved; you can download a pre-build Stingray-API.jar from the attachments instead and skip to the 'Using the Interface Library' section.
Unzip these three archives in your working directory, giving you 3 subdirectories - wsdl, axis-1_4 and javamail-1.4.7.
The process assumes that you’ve downloaded and installed the Java JDK and added it to your path.
Run the WSDL2Java application in Apache axis directory to process each wsdl file and create the Java source files:
C:\> for %F in (wsdl\*.wsdl) do java –cp ;axis-1_4\lib\*;javamail-1.4.7\lib\* org.apache.axis.wsdl.WSDL2Java %F
This will create a subdirectory called 'com' containing the source files for the interface library.
Compile these into class files in an obj directory:
C:\> mkdir obj
C:\> javac –d obj -cp ;axis-1_4\lib\* com\zeus\soap\zxtm\_1_0\*.java
C:\> javac –d obj -cp ;axis-1_4\lib\* com\zeus\soap\zxtm\_1_1\*.java
C:\> javac –d obj -cp ;axis-1_4\lib\* com\zeus\soap\zxtm\_1_2\*.java
Create the Stingray-API.jar file from the compiled class files:
C:\> cd obj
C:\> jar cf Stingray-API.jar com\zeus
Follow the instructions above, but use the following commands:
$ for F in wsdl/*.wsdl ; do java -cp axis-1_4/lib/*:javamail-1.4.7/lib/* org.apache.axis.wsdl.WSDL2Java $F ; done
$ mkdir obj
$ javac -d obj -cp :axis-1_4/lib/* com/zeus/soap/zxtm/*/*.java
$ cd obj
$ jar cf Stingray-API.jar com/zeus
$ mkdir javadoc
$ javadoc -d javadoc -classpath :axis-1_4/lib/*:javamail-1.4.7/lib/* -subpackages com.zeus.soap.zxtm
The resulting javadoc package is attached.
When you create an application that uses Stingray's Control API, you will need to add Stingray-API.jar to your CLASSPATH. The Stingray-API.jar file has a large number of dependencies; it depends on jar files from the Apache Axis 1.4, Javamail and JavaBeans Activation Framework (JAF) packages. Install these jar package files in your third-party Java library location, such as /usr/share/java.
For an example of a simple application that uses the Stingray-API.jar interface library, check out Tech Tip: Using the SOAP Control API with Java.
If you create a Java Extension that uses Stingray's Control API, the easiest way to manage the Stingray-API.jar file and its dependencies is to upload them via the Stingray Admin Interface. The following jar files from the Axis, Javamail and JAF packages will also be required to use Stingray-API.jar:
Stingray-API.jar and dependencies uploaded to the Stingray Admin Interface
Note that axis.jar is listed in the 'Java Extensions' list; this is because it happens to contain a classes that inherit from GenericServlet.
For an example of a Java Extension that uses the Stingray-API.jar library, check out the article Stingray Status - Using the Control API from a Java Extension