Tuesday, December 1, 2009

Presenting Business Objects Reports in PDF Format Using Web Services

Suppose you have a web application, whether of an RIA type or Web 1.0 type, that needs to present a report. One of the attractive options, is to have the report show in the browser as a PDF document. It seems an interesting option, because most users already have Adobe Acrobat Reader installed and are familiar with it. They usually know how to navigate through the document, print it or save it for emailing or just for later use.
If your organization is also one of the many that use Business Objects (BO) as their standard reporting technology, the solution presented below may be for you.

Since version XII, the Business Object Enterprise server is bundled and by default installs the web services module which allows to access reports via SOAP web services. Here's the solution:
  • The web application requests a report by calling the special reporting servlet, passing to it the report ID and required parameters.
  • The servlet uses web services to login to BO server and request the report, which then is returned to the client and displayed in a new browser tab or window in Acrobat Reader.
The example below, shows the solution for the case when the client is a Flex application and the servlet is implemented in Java.

Reporting Servlet
The servlet consists of the following modules:
  • login module (login to BO server)
  • report parms module (requests a list of the parameters required by the report and prepares them)
  • report viewer module (configures the request to return the report in PDF format)
  • retrieve and deliver module (requests the report from BO server and sends it on its way back to the client)
Login Module:

  SessionSoap session = new SessionSoapProxy("http://crystalbo:8080/dswsbobje/services/session");
  EnterpriseCredential credents = new EnterpriseCredential();
  credents.setLogin(businObjectsLoginName);
  credents.setPassword(businObjectsLoginPwd);
  SessionInfo si = session.login(credents);
  if( si == null ) { login failed... }
  // Instantiate Report Engine
  ReportEngineSoap rptEngine = new ReportEngineSoapProxy();

No comments: