Crystal Reports XI Official Guide
Another notable facet of working in the .NET environment is the capability to create a Crystal Report that is available as a web service and that can be consumed by other applications. To highlight how simply this can be accomplished, Figure 29.10 shows Visual Studio after having added an existing sample Crystal Report (World Sales Report) to a new web service project. Enacting the Publish as Web Service function from the right-click menu creates an asmx file with the name of the report prefixing the text service. Figure 29.10. Visual Studio .NET enables the quick and easy publishing of the World Sales Report as a web service.
You can test this Crystal Reports web service out by setting the corresponding WorldSalesReportService.asmx file as the starting page for this web service. This option is accessed through the right-click menu of the .asmx object and can be viewed in the browser by accessing http://localhost/WebServiceName/WorldSalesReportService.asmx (see Figure 29.11). You will be presented with a list of the different operations that the report web service supports. You can view sample SOAP request-and-response information using placeholders by clicking on any of the available operations. Figure 29.11. Viewing the Crystal Reports web service and its associated operations.
To use this web service from another application, you can quickly create a new ASP.NET application called ShowSalesReport (or anything you prefer) and after adding a CrystalReportViewer from the new form's toolbox, bind the ReportSource to either the web service or the involved web service's URL as follows: [View full width] CrystalReportViewer1.ReportSource = http://localhost/WebService1/World Sales ReportService
Tip When adding a Crystal Reports' web service, it is recommended that you eliminate any spaces from the created .asmx web service file. You might experience problems in attempting to click through on the report operations provided by the Crystal Reports' web service when spaces have not been eliminated. Also, remember to build your solutions/projects before testing them in your browser.
|
Категории