REST Service ReportSource Resolver Overview
When implementing the ReportsController you need to provide an IReportSourceResolver implementation, which is used in the Reporting REST Service ReportServiceConfiguration - ReportSourceResolver property. This article elaborates on the Reporting REST Service's ReportSourceResolver purpose, usage, built-in implementations and the option for adding a custom implementation.
Purpose and Usage of the Reporting REST Service ReportSource Resolver
The Reporting REST Service's ReportSourceResolver handles reports on the server.
IReportSourceResolver defines the behavior of an object which takes a string as an argument and resolves it to a valid server-side ReportSource object. The format of this string argument is a matter of implementation, which should contain rules for collaboration between the service clients and the report resolver on the server. For example, if the resolver implementation expects a string containing a path relative to the application root directory, then the client should send a string containing such a path. If the resolver is built to resolve reports from a type name, then a type name should be provided by the service client. Another scenario might require a resolver implementation that expects a report id and pulls the XML report definition from database storage by that report id, then returns it as an XmlReportSource.
The Reporting REST Service's resolver is used when resolving information for a report on the server, which includes:
- Getting information about the report's ReportParameters collection;
- Returning a valid server-side ReportSource;
- Applying client-side parameters' values;
- Exporting the report in a selected format;
- Printing the report which is based on export in PDF file with additional Adobe JavaScript settings - Printing Reports;
- Refresh calls;
- Navigation to another report that is considered as a request for a new report.
Available built-in ReportSource Resolver implementations:
-
UriReportSourceResolver - resolves absolute path UriReportSource from absolute or relative path to declarative report definition files. These are the
TRDX
,TRDP
orTRBP
files created in the Standalone Report Designer or Web Report Designer. - TypeReportSourceResolver - resolves TypeReportSource from report type's assembly qualified name (reports created in Visual Studio Report Designer).
When working with other types of report sources for which there is no built-in report source resolver implementation, use a Custom ReportSource Resolver implementation. For example, when using Drillthrough Report Action with XmlReportSource the action will not work unless a custom report source resolver which can handle XmlReportSource has been implemented.
Custom ReportSource Resolver implementations:
Implementing the IReportSourceResolver interface allows you to include custom logic for creating, modifying, or accessing existing reports on the server, and to use any of the available report sources. An example implementation is available in How To Implement a Custom ReportSource Resolver.
The Telerik.Reporting.Services.IReportSourceResolver.Resolve method will be called each time when the Reporting engine needs the report source. This can happen several times until the report document is completely rendered. It is important that when the method is invoked multiple times it returns exactly the same report source for a given value of the passed string argument.