vADC Docs

Stingray-API.jar: A Java Interface Library for Stingray's SOAP Control API

by on ‎03-21-2013 02:23 AM - edited on ‎07-06-2015 12:14 PM by PaulWallace (1,439 Views)

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.

 

Creating Stingray-API.jar

 

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.

 

Get the source and application files

 

  • Download the Stingray WSDL files from the Stingray Admin Interface (Help -> Manuals):

 

wsdl1.png

 

  • Download Apache Axis 1.4 from http://archive.apache.org/dist/ws/axis/1_4/; you'll need the axis-bin package.  Note that the Stingray WSDL files use RPC/encoded, so that are better supported by the legacy Axis 1.4 rather than Apache Axis2.

 

 

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.

 

Build the Stingray-API.jar library

 

On Windows

 

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

 

On Linux/Unix/MacOSX

 

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

 

Build the Javadoc documentation

 

$ 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.

 

Using the Stingray-API.jar interface library

 

From an application

 

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.

 

From a Java Extension

 

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:

 

  • 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.7/mail.jar
  • jaf-1.1.1/activation.jar

 

wsdl2.png

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

Contributors