使用 SOAP 集成 Reporting Services - Web 应用程序

可以通过 Reporting Services SOAP API 访问报表服务器的完整功能。 因为它是一个 Web 服务,所以您可以轻松地访问 SOAP API 以向自定义业务应用程序提供企业报表功能。 从 Web 应用程序访问报表服务器 Web 服务的方法与从 Microsoft Windows 应用程序访问 SOAP API 的方法非常类似。 通过使用 Microsoft .NET Framework,可以生成一个代理类,该类公开报表服务器 Web 服务的属性和方法。 然后,可以使用熟悉的基础结构和工具在 Reporting Services 技术上构建业务应用程序。

可从 Web 应用程序或 Windows 应用程序轻松访问 Reporting Services 报表管理功能。 在 Web 应用程序中,您可以从报表服务器数据库添加和删除项,设置项安全性,修改报表服务器数据库项,管理计划和传递以及等等。

启用模拟

配置 Web 应用程序的第一步是从 Web 服务客户端启用模拟。 通过模拟,ASP.NET 应用程序可以使用代表其操作的客户端的标识执行。 ASP.NET 依赖于 Microsoft Internet Information Services (IIS) 来对用户身份进行验证,并将已验证的标记传递到 ASP.NET 应用程序,或者,在无法对用户身份进行验证的情况下,传递未通过身份验证的标记。 在任一种情况下,如果启用了模拟,则无论收到哪种标记,ASP.NET 应用程序都会进行模拟。 您可以对于客户端启用模拟,为此,请按以下所示修改客户端应用程序的 Web.config 文件:

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

注意

默认情况下,模拟处于禁用状态。

有关 ASP.NET 模拟的详细信息,请参阅 Microsoft .NET Framework SDK 文档。

使用 SOAP API 管理报表服务器

还可以使用 Web 应用程序管理报表服务器及其内容。 Reporting Services 附带的报表管理器是使用 ASP.NET 和 Reporting Services SOAP API 生成的 Web 应用程序的示例。 您可以将报表管理器的报表管理功能添加到自定义 Web 应用程序。 例如,你可能希望返回报表服务器数据库中可用报表的列表,并将它们显示在 ListboxASP.NET 控件中以供用户从中选择。 下面的代码连接到报表服务器数据库并返回报表服务器数据库中的项列表。 然后,将可用报表添加到 Listbox 控件,而该控件显示每个报表的路径。

还可以使用 Web 应用程序管理报表服务器及其内容。 Reporting Services 附带的 Web 门户是一个 Web 应用程序示例,用于管理通常使用 Reporting Services 执行的大多数任务。 可将 Web 门户的报表管理功能添加到自定义 Web 应用程序。 例如,你可能希望返回报表服务器数据库中可用报表的列表,并将它们显示在 ListboxASP.NET 控件中以供用户从中选择。 下面的代码连接到报表服务器数据库并返回报表服务器数据库中的项列表。 然后,将可用报表添加到 Listbox 控件,而该控件显示每个报表的路径。

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);  
   }  
}  

使用 Web 服务和 .NET Framework 生成应用程序
将 Reporting Services 集成到应用程序中
在 Windows 应用程序中使用 SOAP API