SQLUninterrupted

I am just a medium, SQL Server the Goal

Archive for March 4th, 2012

Dynamically binding a Web Service reference to a Report Server Instance

Posted by Sourabh Agarwal on March 4, 2012

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.

using System.Web.Services;

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.

Posted in Reporting Services | Tagged: , , , , , | 1 Comment »

Adding a Reporting Services Web Reference to .Net application

Posted by Sourabh Agarwal on March 4, 2012

In an earlier post, I had talked about adding a Reporting Services Proxy class using WSDL.exe. In this post, I would talking about adding a Reporting Services Web Service reference to your .Net Application.

As mentioned in the earlier post, SSRS web service provides interface for communication with the Report Server. In order to use the methods exposed by the Web Service, a reference to the Web Service needs to be added to the Visual Studio project. Depending on the requirement, a reference can be added for any of the reporting services endpoints.

  1. ReportService2005
  2. ReportService2006
  3. ReportExecution2005
  4. ReportService2010 (to be used with SSRS 2008 R2).

In order to add, a web service reference to your project, follow the steps provided below.

In solution explorer, right click on the project node and select “Add Service Reference”

image

On the Add Service Reference Window, click on Advanced. This would open the “Service Reference Setting” window. On the Service Reference Setting window, click on “Add Web Reference”.  On the Add Reference window, in the URL section, provide the complete asmx URL for the Reporting Service endpoint which needs to be used. For example, I would be using the ReportService2010 endpoint. Click on Go.

image

When you click on go, the web service reference would be resolved, and the methods available in the web service would be displayed.

In the Web Service Reference name, you can provide any name of your choice, and click on add reference. This would add the desired endpoint reference to your project.

At this post, we have added a web reference to the project. In a next post, I will talk about how to dynamically bind the reference or the proxy class to a Report Server.

Posted in Reporting Services | Tagged: | 4 Comments »

 
Follow

Get every new post delivered to your Inbox.

Join 81 other followers