How to get report url through SSRS web service?

In my project, I have a web link to SSRS (2005). I would like to display links that users can directly accept in the displayed reports. I know that I can provide a link such as this:

http://server/ReportServer/Pages/ReportViewer.aspx?/path/to/report&rs:Command=Render&rc:parameters=false&rs:format=HTML4.0

The question is, how can I get this URL from a web service? And if the report accepts the parameters, is there any way to provide the values ​​to the web service and adjust the format for me?

I know that I can create URLs myself, but I don’t like to reinvent the wheels.

+4
source share
2 answers

There are a few things you should think about about how SSRS works and HOW MUCH TIME you want to invest in a monkey with.

I am. You can go through the root, but I doubt very much that you had this in mind. From the root, you can add items, whether they are directories or reports. And to add to this, you can add the parameter directly to the Rest URI to display the report, and you can also output the value. For instance:

The main part of the address root:

 http:// <server>/ReportServer/Pages/ReportViewer.aspx? 

directory path:

 %2fTest 

message path (marked as one lol name)

 %2fTest 

what to do with him? (visualize)

 &rs:Command=Render 

Insert the parameter and execute it (yes, I also called my Test parameter!)

 &Test=Value 

Combine all of this:

 http:// <servername>/ReportServer/Pages/ReportViewer.aspx?%2fTest%2fTest&rs:Command=Render&Test=Value 

II. You have a database that you can query for moving things, but I believe that MS DOES NOT document it well. Typically, this is a SQL Server database called "ReportServer" on any server that has SSRS installed. Typically, most items are in the "dbo.Catalog" table with a "Type" of 2 for reports. You can get your information and even parameters from them.

III. Do you want to take a full course and dive into .NET and just talk to the service directly? You can do it too. To do this, you need two main services:

  A: http://<Server Name>/reportserver/reportservice2010 (gets info on existing items on server) B: http:// <Server Name>reportserver/reportexecution2005 (gets info for in code creating reports to types directly in code) 

I had a different thread when exporting this here: Programmatically export an SSRS report from sharepoint using ReportService2010.asmx ; but you can also get information. At the same time you created proxy classes (or made a link to web services), you can make the code in .NET this way. These services do all the magic, so without them you cannot model much in SSRS. Basically I create a class that you pass "SERVER", you need to reference a class like "http: /// ReportServer".

 private ReportingService2010 _ReportingService = new ReportingService2010(); private ReportExecutionService _ReportingExecution = new ReportExecutionService(); private string _server { get; set; } public ReaderWriter(string server) { _server = server; _ReportingService.Url = _server + @"/ReportService2010.asmx"; _ReportingService.Credentials = System.Net.CredentialCache.DefaultCredentials; _ReportingExecution.Url = _server + @"/ReportExecution2005.asmx"; _ReportingExecution.Credentials = System.Net.CredentialCache.DefaultCredentials; } public List<ItemParameter> GetReportParameters(string report) { try { return _ReportingService.GetItemParameters(report, null, false, null, null).ToList(); } catch (Exception ex) { MessageBox.Show("Getting Parameter info threw an error:\n " + ex.Message); return new List<ItemParameter> { new ItemParameter { Name = "Parameter Not Found" } }; } } public List<CatalogItem> GetChildInfo(string dest) { try { return _ReportingService.ListChildren("/" + dest, false).ToList(); } catch (Exception ex) { MessageBox.Show("Getting Child info of location threw an error:\n\n" + ex.Message); return new List<CatalogItem> { new CatalogItem { Name = "Path Does Not exist", Path = "Path Does not exist" } }; } } 
+7
source

ListChildren is the way to go. You can always set the second parameter to true to return all directory entries when you have reports in many folders.

 Dim items As CatalogItem() = rs.ListChildren(reportPath, True) 
+1
source

Source: https://habr.com/ru/post/1485677/


All Articles