One of the most important aspect of SQL Server Reporting Services, which makes it stand out amongst competition is its extensibility. If you know .Net programming, then you can almost anything with Reporting services. In this series of posts I would be talking about some things which can be done with .Net and Reporting Services.
Typically speaking, .Net with Reporting Services can be used to create any of the following.
- .Net Applications (console, UI bases) to automate SSRS tasks.
- Reporting Services extensions (data, security, delivery etc.) to be used with Reporting Services.
- Reference libraries to be used directly with the Reports in Reporting Services.
- .Net code to (web service, Forms application) to consume Reporting Services Reports.
In this post, I would be talking about how to dynamically bind a report server instance using a web service reference.
Reporting Services Web service provides a SOAP over HTTP interface for communication with the Report Server. It provides two endpoints, one for execution and another for management. The most important thing, when creating an application for SSRS is to the add the Reporting services proxy class to the project to the class. This can be done using one of the two ways.
Once you have added the web service reference, using any of the two methods described above, the most important thing is to dynamically bind the web service to a Report Server instance.
To dynamically bind the web service to any Report Server of your choice.
- First create an instance of the SSRS web service, which was added to the project. For example, if you added the ReportService2010 endpoint, create an object for the same.
- Set the URL property of this object to the desired Report Server web service URL.
- Define appropriate security credentials.
ReportingService2010 rs = new ReportingService2010();
rs.Url = "http://localhost/reportserver/ReportService2010.asmx";
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
To make sure that the URL property is recognized by the compiler, you would need to add the following reference to your code.
At this point, we can call any method defined in the Web Service and perform the desired operation.
In the next post, I will talk about, creating an Application, which can upload, all the .RDL files present in a folder to a report server.