BackPrevious Topic  Next TopicNext

Java API for an Application

You can call Report Server directly in your application using Report Server API or Remote Server API, instead of using JSP pages and URLs. This topic describes the two types of server APIs and how you can use them to write client code.

  • Report Server API: Report provides a library of methods to directly start Report Server as part of the customers application running in the same JVM as the application.
  • Report Remote Server API: Report provides methods to connect to an already running instance of Report Server either running on the local machine in a different JVM or running on an entirely different server. Other than the first call to connect either using RMI or directly in the current JVM, the rest of the API is identical so it is easy to write an application that can work either remotely or locally the same as the JSP pages that Report provides.

This topic contains the following sections:

How to Write Client Code Using the Server API

If you want the entire Report Server to run in the context of your application in the same JVM you can use the Server API. The Server when started this way starts a number of threads and runs exactly the same as when the server is started as a standalone server. The server starts and stops with the application. The access to the server such as RMI access from other applications is still allowed.

//set reporthome
System.getProperties().put("reporthome", "C:\\LogiReport\\Server");
// Creates instance of RptServer (this does nothing if Report Server is already running in this JVM)
HttpUtil.initEnv(System.getProperties());
// Get a handle to the server instance
RptServer server = HttpUtil.getHttpRptServer();

How to Write Client Code Using the Remote Server API

It is exactly the same code as above except you get a remote handle to the RPTServer.

//set reporthome for logging and location of rmi.auth file for security
System.getProperties().put("reporthome", "C:\\LogiReport\\Server");
System.getProperties().put("jrs.rmi.auth_file", "C:\\LogiReport\\Server\\bin\\rmi.auth");
//search the running server using default host and port
String host = "localhost";
String port = "1129";
RptServer server = :diffupdate
RemoteReportServerToolkit.getRemoteWrappedRptServer(host, port);

Back to top

BackPrevious Topic  Next TopicNext