Question:
Colleagues! Prompt the library for the SSRS API. I'm trying from WebApi to make a request to the report server and request some kind of report. I make a request via HttpClient, but if I'm not mistaken, there are ready-made libraries for working with the reporting service, and getting them in C # code. Now, to get a response from the service, you have to write your own classes – models.
Answer:
According to MSDN for SQL Server 2014, you need to use the Microsoft.SqlServer.ReportExecution2010
, Microsoft.SqlServer.ReportingServices2010
and Microsoft.ReportViewer.Common
libraries. In particular, Microsoft.SqlServer.ReportingServices2010
contains a ListChildren
method that returns a list of reports contained in the specified folder.
You can get the ReportExecution2010.ReportExecutionService class from the wsdl-description of the web service of your report server at http://<сервер>/<экземпляр reporting service>/ReportExecution2010.asmx?wsdl
To generate a report, the algorithm is as follows:
- Get a report template from the server using
ReportExecution2005.LoadReport(string Report, string HistoryID)
- Prepare a list of parameters for the report in the format
ReportExec2005.ParameterValue[]
- Set parameters to the report template using
ReportExec2005.SetExecutionParameters(ParameterValue[] Parameters, string ParameterLanguage)
- Get an array of bytes with the result of preparing a report using
ReportExec2005.Render(string Format, string DeviceInfo, out string Extension, out string MimeType, out string Encoding, out Warning[] Warnings, out string[] StreamIds)
. If you want to get a report in * .pdf, then theFormat
value must bePDF
.