Share via


Binding to a Report Web Service URL

Object Model

This report binding scenario uses the CrystalReportViewer (see Report Binding with CrystalReportViewer Object Model.)

Location of Reports

Reports are located as a Report Web Service, hosted on a (typically remote) Web server.

Description

A report, which is stored on another server and served as a Report Web Service, is bound by its URL to the CrystalReportViewer control.

Pros

  • Wide distribution: reports can exist anywhere on the Internet.
  • Ease of distribution: Report Web Services are on port 80, so they can be accessed even through firewalls.

Cons

  • Limited object model: this binding scenario offers only the limited object model that is part of the CrystalReportViewer. See Which Object Model Should I Use?.

Implementation

Note

This procedure works only with a project that has been created from Project Setup. Project Setup contains specific namespace references and code configuration that is required for this procedure, and you will be unable to complete the procedure without that configuration. Therefore, before you begin this procedure, you must first follow the steps in Project Setup.

  • Within the ConfigureCrystalReports() method (that you have created in Project Setup), assign a Report Web Service URL string to the ReportSource property of CrystalReportViewer class.

    This binds the report directly to the control. All programmatic interaction with the report must be done within the limited CrystalReportViewer object model.

    myCrystalReportViewer.ReportSource = _
       "https://localhost/TestProject/World_Sales_ReportService.asmx"
    
    crystalReportViewer.ReportSource = 
       "https://localhost/TestProject/World_Sales_ReportService.asmx";
    

    Note

    To use this binding scenario, create a Report Web Services project in Visual Studio. For more information, see Publishing and Consuming a Report as a Web Service.