Using the SOAP API in a Windows Application

You can access the full functionality of the report server through the Reporting Services SOAP API. The SOAP API is a Web service and, as such, can be easily accessed to provide enterprise reporting features to your custom business applications. You can access the Web service in a Windows application simply by writing code that makes calls to the service. Using the Microsoft .NET Framework, you can generate a proxy class that exposes the properties and methods of the Web service and enables you to use a familiar infrastructure and tools to build business applications built on Reporting Services technology.

Integrating Report Management Functionality Using Windows Forms

Unlike URL access, the SOAP API exposes the complete set of management functions that are available through the report server. This means that the entire administrative functionality of Report Manager is available to developers through SOAP. As such, you can develop a complete management and administration tool using Windows Forms. For example, in your Windows application, you might want to enable your users to retrieve the contents of the report server namespace. To do this, you could use the Web service ListChildren method to list all the items in the report server database and then use a Listview, Treeview, or Combobox control to display those items to your users. The following Web service code might be used to retrieve the current list of available reports in a user's My Reports folder when a user clicks a button on a form:

' Button click event that retrieves a list of reports from
' the My Reports folder and displays them in a combo box
Private Sub listReportsButton_Click(sender As Object, e As System.EventArgs)
   ' Create a new Web service object and set credentials
   ' to Windows Authentication
   Dim rs As New ReportingService2005()
   rs.Credentials = System.Net.CredentialCache.DefaultCredentials

   ' Return the list of items in My Reports
   Dim items As CatalogItem() = rs.ListChildren("/Adventureworks Sample Reports", False)

   Dim ci As CatalogItem
   For Each ci In  items
      ' If the item is a report, add it to 
      ' a combo box
      If ci.Type = ItemTypeEnum.Report Then
      End If
   Next ci
End Sub 'listReportsButton_Click
// Button click event that retrieves a list of reports from
// the My Reports folder and displays them in a combo box
private void listReportsButton_Click(object sender, System.EventArgs e)
   // Create a new Web service object and set credentials
   // to Windows Authentication
   ReportingService2005 rs = new ReportingService2005();
   rs.Credentials = System.Net.CredentialCache.DefaultCredentials;

   // Return the list of items in My Reports
   CatalogItem[] items = rs.ListChildren("/Adventureworks Sample Reports", false);

   foreach (CatalogItem ci in items)
      // If the item is a report, add it to 
      // a combo box
      if (ci.Type == ItemTypeEnum.Report)

From there, you might enable users to select the report from the Combo box and preview the report on the form either using a Web browser control or an image control.

Enabling Report Viewing and Navigation Using Windows Forms

There are two methods available for integrating reports into your Windows Forms applications.

You can use the SOAP API to render reports to any of the supported rendering formats using the Render method. There are slight disadvantages to enabling report viewing and navigation through SOAP:

  • You cannot take advantage of the built-in functionality of the report toolbar that is included with the HTML Viewer through URL access.
  • If you render to HTML, you must separately render any images or resources as additional streams using the RenderStream method.
  • There is a slight performance advantage to rendering reports using URL access over using the SOAP API.

However, the Render method of the SOAP API can be used to render reports and save them to various output formats programmatically. This is an advantage over URL access, which requires user interaction. When you render a report using the SOAP API Render method, you can render to any of the supported output formats.

You can also use the freely distributable ReportViewer controls that are included with Microsoft Visual Studio 2005. The ReportViewer controls make it easy to embed Reporting Services functionality into custom applications. The ReportViewer controls are intended for developers who want to provide predesigned, fully authored reports as part of an application feature set (for example, a Web site management application might include reports that show click-stream analysis on company Web sites). Embedding the controls in an application provides a streamlined alternative to including the Reporting Services server components in your application deployment. The controls provide report functionality, but without the additional report authoring, publication, or distribution and delivery support that you find in Reporting Services.

There are two versions of the ReportViewer controls, one for rich Windows client applications and one for ASP.NET applications. The controls support both local processing and remote processing modes. In local processing mode, your application provides the report definition and datasets and triggers report processing. In remote processing mode, data retrieval and report processing happen on the report server and the control is used for display and report navigation. This model allows you to build rich applications that can be scaled from desktop to the enterprise.

ReportViewer controls are documented in Visual Studio 2005 online Help. For more information, see the Visual Studio 2005 product documentation.

See Also


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

Other Resources

Building Applications Using the Web Service and the .NET Framework
Reporting Services Programmability Enhancements

Help and Information

Getting SQL Server 2005 Assistance