SQL Server Reporting Services (SSRS) is a server-based report generator software of Microsoft. It serves to make, send and oversee reports utilizing programming languages like C# and Visual Basic. SSRS comes bundled with Microsoft SQL Server services. It provides immense benefit in terms of reducing the complexity of the reports which are extremely customized as well as are dealing with a very large volume of data.
Following are the steps to integrate SSRS web service 2010 with the C# web application by creating the web service proxy class using Web Services Description Language (WSDL)
Create a Visual studio 2012 Web application say MySSRSWebPortal.
Open “Developer command prompt for VS2012”,
Go to the project root. Let say: D MySSRSWebPortalMySSRSWebPortal
Now create the web proxy for report server 2010 use the wsdl command to create this proxy class (https://msdn.microsoft.com/en-us/library/7h3ystb6(VS.80).aspx)
Execute below command:
wsdl /language:CS /n:”Microsoft.SqlServer.ReportingServices2010″ http://<Server Name>/ReportServer/reportservice2010.asmx?wsdl
Incase you receive the following Error :
The request failed with HTTP status 401: Unauthorized.
It means you are required to pass the authentication parameter with the command:
wsdl /language:CS /n:”Microsoft.SqlServer.ReportingServices2010″ /U:”<User name>” /p:”<PassWord>” http://<Server Name>/ReportServer/reportservice2010.asmx?wsdl
After executing this command ReportingService2010.cs file is created on the root folder
Microsoft (R) Web Services Description Language Utility
[Microsoft (R) .NET Framework, Version 4.0.30319.17929]
Copyright (C) Microsoft Corporation. All rights reserved.
Writing file’D MySSRSWebPortalMySSRSWebPortalReportingService2010.cs‘.
Add this file to the application. You will be able to see all the properties and methods for reporting service 2010 in this generated file. For more information about the reporting service 2010 methods and properties, visit the following link:
Now list all the reports on the server. Create one aspx page, let say Index.aspx
Now to get the list of reports from the server the ReportingService2010 have “ListChildren” method, they give all the reports from the folder specified in the parameter. Now on page load create the reporting service object, set the network Credentials, and call the method, it will return the collection of catalog items. Create one repeater and bind with the collection.
Now if reporting server required the authentication then you have some change in code.
Create one class let say ReportServerCredentials that inherit IReportServerCredentials interface (add Microsoft.Reporting.WebForms reference).
Interface have two properties:
1) ImpersonationUser : We don’t require this property so Set Return NULL
2) NetworkCredentials : Set network credential for reporting service.
Also, interface has one method:
GetFormsCredentials: we didn’t use this method.
In Fig 4.0.1 replace service.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials; To ReportServerCredentials reportServerCredentials = new ReportServerCredentials ();service.Credentials = reportServerCredentials.NetworkCredentials;
Run the index.aspx page. You can see the list of reports name. Success!
Microsoft supplements its social database engine, SQL Server, with a few extra administrations that oversee diverse parts of big business knowledge and data handling, for example, information coordination, reporting, and analysis. While SQL Server can work freely of these administrations, they include esteem by improving SQL Server’s ability as a hearty data stage for creating far-reaching business insight arrangements.
In subsequent series, we will be covering further customized & advanced implementation of SSRS. With fast evolving technology, it is time to implement the latest Microsoft technologies for your business.
WRITTEN BY: Parth Patel
Parth Patel is a Microsoft Certified Solution Associate (MCSA) and DotNet Team Lead at CMARIX, a leading Asp.net mvc development company. With 10+ years of…
FEW MORE POSTS BY Parth Patel: