This is an example of Java Actuate client which uses an automatically generated proxy. The proxy is generated from a WSDL file using AXIS library.
Ant build file (http://jakarta.apache.org/ant/) |
|
setClassPath.bat |
Batch file to set classpath |
Java source code for the example program. The proxy source code will be generate here also |
|
|
Example WSDL file |
lib/ |
Libraries used in this example |
webApplication/ |
The base directory containing web applications example |
webApplication/css |
Cascading Style Sheet used to view reports |
webApplication/js |
JavaScript used to view DHTML reports |
report/ |
Contains report to be used with the example program |
You must set up your CLASSPATH to include all the libraries required, source, and build directory. You can use setClassPath.bat to do this in Windows.
The following libraries are required and they are provided in the lib directory for convenience
-
AXIS
http://xml.apache.org/axis/index.html
-
Xerces XML Parser
http://xml.apache.org/xerces2-j/index.html
-
JavaBeans(TM) Activation Framework (JAF) 1.0.2
http://java.sun.com/products/javabeans/glasgow/jaf.html
-
JavaMail(TM) 1.3
http://java.sun.com/products/javamail/index.html
-
SOAP with Attachments API for JavaTM
http://java.sun.com/xml/downloads/saaj.html
This examples assume you have a report server already running on the local machine. To test this, you can point your browser to http://localhost:8000/wsdl. You should be able to browse Actuate WSDL files.
First, you need to generate the proxy source code then you can build example program. You can use ant or an IDE such as eclipse to do this.
The following commands (in build.bat) will generate the proxy source code in the source directory from a running report server.
java org.apache.axis.wsdl.WSDL2Java -o source -O -1
http://localhost:8000/wsdl/v11/axis/all
mkdir build
javac -d build source\Administrate.java
javac -d build source\SelectFiles.java
javac -d build source\SubmitJob.java
javac -d build source\GetFolderItems.java
javac -d build source\SelectPage.java
javac -d build source\ExecuteReport.java
javac -d build source\UploadFile.java
javac -d build source\DownloadFile.java
javac -d build source\Counter.java
javac -d build source\UpdateJobSchedule.java
If you have ant, you can run the build by typing
ant compile -DhostName=localhost -Dport=8000
The ant rule in build.xml has a target proxySource that generate
the source proxy from the following property
<property name="wsdl" value="http://localhost:8000/wsdl/v11/axis/all"/>
For example the following command runs ant to build the proxySource with the WSDL file at the specified URL;
ant
-Dwsdl=http://localhost:8000/wsdl/v11/axis/all proxySource
A WSDL file is also included in the source directory, if you want to use the file you can comment the wsdl property above, and uncomment the following:
<!-- property name="wsdl" location="${src}/ActuateAPI.wsdl"/ -->
Before you can run Ant there are some additional settings you will need to do:
- Set the ANT_HOME environment variable to the directory where you installed Ant
- It is recommended to set the JAVA_HOME environment variable to the directory where your JDK is installed
- Add the $ANT_HOME/bin and $JAVA_HOME/bin directories to your path
You can use WebSphere Application Developer to build and run this sample application. To do this, you need to create a new Java project in the IDE with the location of this sample or import all the files from this sample to the project.
Alternatively, copy all the files to the new project's folder. Then you can right click on build.xml and choose run Ant to build the sourceProxy.
Available sample program:
- Administrate demonstrates administrative operations
- SelectFiles demonstrates select files operation
- SubmitJob demonstrates scheduled job submission with parameters
- GetFolderItems demonstrates get folder items
- SelectPage demonstrates page download
- ExecuteReport demonstrates report execution
- UploadFile demonstrates file upload
- DownloadFile demonstrates file download
- Counter demonstrates getting all iServer counters
- UpdateJobSchedule demonstrates UpdateJobSchedule administrate operation
After building, you can run all the sample program with runTest.bat.
You can run each sample program with “–h” option to get the information about command line options available for the program.
java
UploadFile [options] <localFileName> [encyclopediaFileName]
Options:
-h hostname specify SOAP endpoint
-u username specify username
-p password specify password
-v volume specify target volume
-? print this usage
UploadFile can be used to upload any kind of file to encyclopedia including 3rd party reports and ROV files. The server takes care the creation of compound document. Here's a simple explicit example which should be run before running the other examples:
java UploadFile -h http://localhost:8000 -v volume
report\SampleBIRTReport.rptdesign /report/SampleBIRTReport.rptdesign
java Administrate -v volume
java SelectFiles -h http://localhost:8000 -v volume
java SubmitJob -v volume
java Counter -h http://localhost:8000 -v volume
java UpdateJobSchedule -h
http://localhost:8000 -v volume "Monthly
Report"
java DownloadFile -v volume /report/SampleBIRTReport.rptdesign download
java ExecuteReport -v volume /report/SampleBIRTReport.rptdesign
/output/SampleBIRTReport.rptdocument
java GetFolderItems -h
http://localhost:8000 -v volume /output
java SelectPage -v volume /report/SampleBIRTReport.rptdocument 1