Partilhar via


Using the SOAP API in a Web Application

You can access the full functionality of the report server through the Reporting Services SOAP API. Because it's a Web service, the SOAP API can be easily accessed to provide enterprise reporting features to your custom business applications. You access the Report Server Web service from a Web application in much the same way that you access the SOAP API from a Microsoft Windows application. Using the Microsoft .NET Framework, you can generate a proxy class that exposes the properties and methods of the Report Server Web service and enables you to use a familiar infrastructure and tools to build business applications on Reporting Services technology.

Reporting Services report management functionality is just as easily accessed from a Web application as from a Windows application. From a Web application, you can add and remove items from the report server database, set item security, modify report server database items, manage scheduling and delivery, and more.

Enabling Impersonation

The first step in configuring your Web application is to enable impersonation from the Web service client. With impersonation, ASP.NET applications can execute with the identity of the client on whose behalf they are operating. ASP.NET relies on Microsoft Internet Information Services (IIS) to authenticate the user and either pass an authenticated token to the ASP.NET application or, if unable to authenticate the user, pass an unauthenticated token. In either case, the ASP.NET application impersonates whichever token is received if impersonation is enabled. You can enable impersonation on the client, by modifying the Web.config file of the client application as follows:

<!-- Web.config file. -->
<identity impersonate="true"/>

Note

Impersonation is disabled by default.

For more information about ASP.NET impersonation, see the Microsoft .NET Framework SDK documentation.

Managing the Report Server using SOAP API

You can also use your Web application to manage a report server and its contents. Report Manager, included with Reporting Services, is an example of a Web application that is completely built using ASP.NET and the Reporting Services SOAP API. You can add the report management functionality of Report Manager to your custom Web applications. For example, you might want to return a list of available reports in the report server database and display them in a ASP.NET Listbox control for your users to choose from. The following code connects to the report server database and returns a list of items in the report server database. The available reports are then added to a Listbox control, which displays the path of each report.

Private Sub Page_Load(sender As Object, e As System.EventArgs)
   ' Create a Web service proxy object and set credentials
   Dim rs As New ReportingService2005()
   rs.Credentials = System.Net.CredentialCache.DefaultCredentials

   ' Return a list of catalog items in the report server database
   Dim items As CatalogItem() = rs.ListChildren("/", True)

   ' For each report, display the path of the report in a Listbox
   Dim ci As CatalogItem
   For Each ci In  items
      If ci.Type = ItemTypeEnum.Report Then
         catalogListBox.Items.Add(ci.Path)
      End If
   Next ci
End Sub ' Page_Load 
private void Page_Load(object sender, System.EventArgs e)
{
   // Create a Web service proxy object and set credentials
   ReportingService2005 rs = new ReportingService2005();
   rs.Credentials = System.Net.CredentialCache.DefaultCredentials;

   // Return a list of catalog items in the report server database
   CatalogItem[] items = rs.ListChildren("/", true);

   // For each report, display the path of the report in a Listbox
   foreach(CatalogItem ci in items)
   {
      if (ci.Type == ItemTypeEnum.Report)
         catalogListBox.Items.Add(ci.Path);
   }
}

See Also

Concepts

Integrating Reporting Services into Applications
Using the SOAP API in a Windows Application

Other Resources

Building Applications Using the Web Service and the .NET Framework
Report Manager

Help and Information

Getting SQL Server 2005 Assistance