Encyclopedia Reporting Example


Main Page | Discussion | Edit | History | Help | Switch to MediaWiki mode


The Encyclopedia Reporting Example is part of the Server Integration Technology download available from BIRT Exchange. It shows how to use BIRT reports to display information from the iServer Express Encyclopedia.

Contents

Description

This example shows how to use the BIRT Web Services Data Source to retrieve information from the Actuate iServer using the Actuate IDAPI. The Web Services Data Source in this example uses a custom connector class to perform the IDAPI communications with the Actuate iServer.

The example includes a report which performs three IDAPI operations: SelectUsers, SelectRoles, and SelectFiles. The Web Service data source takes the responses from these operations to generate a data set in the same way it would take a result set returned from a database query.

Background

This example shows how to use BIRT reports to display information from the iServer Express Encyclopedia. The Encyclopedia is the database which stores information about reports, users, roles, jobs, etc. iServer Express provides a web services API called the IDAPI that performs a wide range of operations including queries against the Encyclopedia.

The example uses BIRT report elements that retrieve data from web services. The Web Services data source manages a connection to a SOAP server. Eclipse BIRT provides a Web Services data source that does most of the work required to connect to a web service. (See the references in the [#Documentation|Documentation section] below.) This data source needs custom Java code to add login credentials to the SOAP header sent to the server. The example includes Java code (in both source and compiled form) that perform these tasks for iServer Express. You can use this code directly in your own application.

The Web Services data set sends a SOAP message and parses the response into BIRT's row-and-column data set format. Most of the work to get data from the Encyclopedia, or indeed any web service, is in building the required Web Services data set.

The Example Report

The example report demonstrates the IDAPI data source by listing users, roles and files from your iServer Express instance. The report itself is simply an example; but you can copy and past the data sources and data sets into your own application.

The report lists the users, roles and files. User information includes name, home folder, e-mail address and more. Role information includes name and description. File information displays the entire folder hierarchy using a depth-first scan. Each file displays the name, version number, type, size and more.

The following is an example report run from within Eclipse:

Sample Run of the Example Report

Example Contents

The files for this example reside in "Actuate 9/ServerIntTech/Encyclopedia Reporting". The example directory contains two subdirectories: "BIRT Reports" which applies to iServer Express and "e.Reports" which applies to the Enterprise product and won't be further discussed here. "BIRT Reports" contains the following:

Reports/
Contains the example BIRT report which lists users, roles and files. Also contains sample XML requests and responses for each of the IDAP calls that the report uses. These are necessary to edit the data sets as described below.
Source/
Contains two Java classes that manage the SOAP connection to iServer Express: WebServiceConnection and WebServiceDriver.
Jar/
A compiled version of the above source files.
readme.txt
A brief description of the example.

About Data Tools Class Paths

The Web Services Data Source and Data Set used in this example are based on components provided by the Eclipse Data Tools project. As a result, they do not use the same class path mechanisms as the rest of BIRT: you cannot put your custom driver classes in the usual BIRT locations, nor can you upload the driver JAR file to the server as described in Publish BIRT Resources to iServer Express. Instead, you must use the techniques described below. This is a known issue in both the Eclipse Data Tools project and iServer Express team and may be improved in a future release.

Try the Example

Create a Project in Eclipse

The best way to try the example is to create an Eclipse project that holds the example files. Here's how:

  • Select File → New → Project...
  • Choose Java → Java Project. (The example includes both reports and Java code, but we'll put them both into a Java project.)
  • Click Next >.
  • Enter "Encyclopedia Reporting Example" for the project name.
  • Click Next >.
  • Click Finish.
  • Copy "ServerIntTech/Encyclopedia Reporting/BIRT Reports/Reports/BIRTReporting.rptdesign" into your new project directory (usually located under "Eclipse project directory/Encyclopedia Reporting Example".
  • Copy the contents of ""ServerIntTech/Encyclopedia Reporting/BIRT Reports/Source" into your new project's src directory ("Eclipse project directory/Encyclopedia Reporting Example/src".)
  • Optionally, copy "ServerIntTech/Encyclopedia Reporting/readme.txt" to your new project directory.
  • In Eclipse, open the Navigator view if it is not yet open: Window → Show View → Navigator.
  • In the Navigator, select your project, "Encyclopedia Reporting Example".
  • Using the right mouse button, select Refresh.

Specify the iServer Express Machine and Port

The example report is designed to connect to an iServer Express running on the local machine using default port numbers. If iServer Express is on a remote machine, or you changed the port numbers during install, then you'll need to adjust these values.

  • Select the BIRT perspective in Eclipse: Window → Open Perspective → Other... → Report Design.
  • Open the Data Explorer view.
  • Open the Data Sources node.
  • Double-click iServer IDAPI Web Service to open the properties dialog:

Web Services Data Source Properties Dialog

  • If your iServer Express is remote, change the WSDL Descriptor and SOAP End Point to replace "localhost" with the correct machine name.
  • If your iServer Express uses a custom port number, replace "8000" in both fields with the correct part number.

Correct the Jar File Path

The example includes a JAR file, but the path to the jar file is incorrect. We'll need to fix it.

  • Open the properties dialog for the "iServer IDAPI Web Service" data source as described above.
  • In the "Driver Class Path" field, change the path to the location of the jar file within your example directory. If you installed in the standard location on Windows, the path is:

...\Actuate9\ServerIntTech\Encyclopedia Reporting\BIRT Reports\Jar\BIRTReporting.jar;

Where "...\Actuate9" is the location of your Server Integration Technology install, usually C:/Program Files/Actuate9 on Windows.

  • Click Test Connection. The dialog should say, "Ping succeeded!".
  • Click OK to save your changes.

Note that the driver jar file path here must be absolute due to issues described above. The class path you specify here is used by the BIRT designer. However, it is not used when the report is run on iServer Express. Hence, the path here must be visible from the BIRT designer, but need not be visible to iServer Express.

Run the Report

  • With the reporting perspective open (see above), click the Preview tab within the report designer.

The report will run. The report sends a series of SOAP messages to iServer Express, parses the response into row and columns, formats the data into a report, and displays the result. The first run might take a while to cache the needed information. The second and subsequent runs are much faster. The preview tab will display the sample report shown earlier.

While we ran the report in Eclipse, it can also be run on the server. Simply:

  1. upload the report to iServer Express,
  2. upload the JAR file and
  3. run the report.

Tips for Creating Your Own Reports

The example report shows the basics of creating BIRT reports against the iServer Encyclopedia. This section explores some of the details involved in creating your own reports.

Choosing What to Display

The iServer Express IDAPI provides a wealth of information about your Encyclopedia. In fact, iPortal and Management console use IDAPI to perform all their operations. The job is to identify which information you need, and to craft a data source and report that present that information. To learn with the IDAPI provides, see the documentation references below.

Define the Web Services Data Source

The example Web Services Data Source driver connects to iServer Express using the "administrator" login with no password. While this works for a prototype, it does not work once you change the administrator password.

One solution is to create a special "reporting" user with the right permissions. Hard-code that user name and password into the driver code, and rebuild the driver. Another solution is to store login information in a configuration file that your driver reads. (The BIRT report cannot pass parameters to the driver, nor does the driver have access to BIRT's connection profile mechanism.)

BIRT will use your driver in three different ways. The BIRT designer locates your driver JAR differently than iServer Express.

BIRT Designer
The Designer uses your driver when building the data source and data sets. BIRT uses the absolute path in the Driver Class Path field to locate the driver. (The path must be absolute; the Web Services data source does not use BIRT's class path.)
BIRT Engine (in Designer)
The BIRT engine runs your report when you click on the Preview tab within the designer. Also uses the absolute path in the Driver Class Path field.
BIRT engine on iServer Express
BIRT looks for the driver in the Actuate9\iServer\JavaReportAPI\engines\birt\lib directory within the file system. The Web Service data source does not look in the iServer Express /Resource folder (where most other BIRT JAR files are put), nor does iServer Express use the Driver Class Path field.

Define the Web Services Data Set

If you want to report on users, roles or files, you can simply copy the data sets from the example report. If you want to report on any of the other data available on the server (jobs, groups, role assignments, schedules, etc.), then you'll need to create a data set to retrieve the data.

Modify the Example Data Sets

The example reports show how to report on users, roles and files. You can create your own reports on these objects simply by modifying the example data sets. Here's how.

Copy the data set into your report. In order to change the data set, you must correct the location to the sample response. We'll show how to do this in the sample report.

  • Open the Data Explorer.
  • Expand the Data Sets node.
  • Double-click the Users Data Set.
  • Select the SOAP Response page:

SOAP Response page of the Web Services Data Set Properties Dialog

BIRT requires a sample of the response in order to determine the set of columns available for use. BIRT can get a live sample (by selecting Query Web Services at SOAP end point"), or by using external sample data. The example report uses the latter approach. However, the path in the example report is incorrect, and you must adjust it.

  • In the "Use external sample data file" field, change the entry to the location of the sample XML response.

In the default Windows installation, the file is at:

C:/Program Files/Actuate9/ServerIntTech/Encyclopedia Reporting/BIRT Reports/Reports/SelectUsers_response.xml

  • Click Table Mapping to ensure the file is correct. You'll get an error if not:

Error dialog for incorrect example response path

The Table Mapping tab chooses the element from the response that contains each item of returned data. For the Users data source, it is the User element shown in the XPath Expression field.

Web Services Data Set Properties, Table Mapping Page

  • Click Column Mapping.

This page shows the fields available within the table structure selected above.

Web Services Data Set Properties, Column Mapping Page

You can see that the example provides columns for a small subset of the available fields. Note that not all returned fields apply to iServer Express; some apply to other versions of the product.

Create a New Data Set

To be done...

Documentation

See BIRT: A Field Guide to Reporting, 2e, Chapter 6, section "Accessing a web service" for more information about the Web Services data source.

See Integrating and Extending BIRT, 2e, Chaper 12, "Creating a web services data source using a custom connection class" for more information about the custom connection used to access the iServer Express IDAPI.

See http://www.birt-exchange.com/modules/documentation/ → BIRT Deployment → iServer Express Report Server → Programming with Actuate iServer APIs for information on the IDAPI web services API to iServer Express.


Retrieved from "http://www.birt-exchange.com/wiki/Encyclopedia_Reporting_Example/"

This page has been accessed 590 times. This page was last modified 09:23, 10 July 2008.