ActiveReports 9 > ActiveReports User Guide > Samples and Walkthroughs > Walkthroughs > Common Walkthroughs > Web > Document Web Service |
With ASP.NET and ActiveReports, you can set up a Web Service that returns a report document which can be shown in a report viewer control.
This walkthrough illustrates how to create a Web Service that returns the contents of an ActiveReports as a byte array.
This walkthrough is split up into the following activities:
Note: For the information on how to connect your report to data and how to create the report layout, please see Single Layout Reports (for a page report) or Basic Data Bound Reports (for a section report). |
When you have completed this walkthrough, you will have a Web Service that returns the contents of an ActiveReports as a byte array.
To create an ASP.NET Web Service project
To write the code to create the Web Method
The following example demonstrates how you create the Web Method for a section report.
Visual Basic.NET code. REPLACE the existing WebMethod and function with this code. |
Copy Code
|
---|---|
<WebMethod( _ Description:="Returns a products report grouped by category")> _ Public Function GetProductsReport() As Byte() Dim rpt As New rptProducts() rpt.Run() Return rpt.Document.Content End Function |
The following example demonstrates how you create the Web Method for a section report.
Visual Basic.NET code. REPLACE the existing WebMethod and function with this code. |
Copy Code
|
---|---|
<WebMethod( _ Description:="Returns a products report grouped by category")> _ Public Function GetProductsReport() As Byte() Dim rpt As New rptProducts() rpt.Run() Return rpt.Document.Content End Function |
To write the code in C#
Copy Code
|
|
---|---|
To test the Document Web Service
To publish the Document Web Service
Note: Get the SiteName from the Internet Information Services Manager. |
To check the configuration in IIS
For information on consuming the Document Web Service in a viewer, see Document Windows Application.