ReportBuilder REST Services allows for the simple creation of a report REST server that may be accessed via any mobile device using the mobile client components. This article gives an overview of the REST Services components, how they are used, as well as a simple tutorial.
The ReportBuilder REST Service components are installed into the Delphi Component Pallet and are available for Win32 and Win64 VCL platforms. These components provide the means necessary to generate and transfer reports built with ReportBuilder to a REST client residing on the platform of choice. Below is a brief description of each component.
- TrbRestService: Represents the ReportBuilder REST Service. Use RestService to build a REST server application. This component typically resides on a web module and then a TDataModule is used to implement a report module, which hosts the TppRestReportProvider and TppReportDirectory components.
- TrbRestReportProvider: Use RestReportProvider to implement a report module for a TrbRestService application.
- TrbReportDirectory: Use ReportDirectory to represent a collection of reports or archives in a REST server application.
Tutorial: Creating a simple file REST server
1. Select File | New | Other from the Delphi main menu. From there navigate to the Web Broker section and create a new Web Server Application. Follow the wizard instructions and create a stand-alone Windows VCL app. Define a valid port for your server to use (ex. 8080) and finish the wizard.
– Add code to the Default Handler Action event to process the request:
if rbRestService.IsServiceRequest(String(Request.PathInfo)) then
– Define the DirectoryName and FileDirectory properties of the TrbReportDirectory component. The DirectoryName property is the name shown in the client, the FileDirectory property is the location on disk that the reports are located.
– Register the datamodule with the REST Report Provider Factory in the initialization section using similar code: (The second parameter of the RegisterModule routine should be the DirectoryName)
Note: If the reports need data access, this datamodule is an ideal location for the delphi DB components.