Professional.Crystal.Reports.for.Visual.Studio..NET [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Professional.Crystal.Reports.for.Visual.Studio..NET [Electronic resources] - نسخه متنی

David McAmis

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
توضیحات
افزودن یادداشت جدید



























Consuming XML Report Web Services


When consuming XML Report Web Services, the .asmx file associated with the service provides the entry point for consumption. When you request this .asmx file without any additional parameters or strings attached, the service will display a default help page like the one shown below, listing all of the methods that are available for the service.



From the listing of methods, you can drill down for further information about their use. In addition, you can invoke methods that support using the HTTP-POST protocol - with Report Web Services, the only method that supports the POST protocol is the Test Report method shown below.


When you invoke this method, the result should be a summary of the report information, including the title of the report and the file name.


External Report Web Service


The first method we are going to look at for consuming an XML Report Web Service from an application uses a direct URL call to the Report Web Service from the Crystal Windows or Web Report Viewer. To use this method you would need to first have created your Web Service and noted the location and URL of the ASMX file, which we have already done.

Next, we need to create a project from within Visual Studio by selecting File | New | Project and from Visual Basic Applications, select Windows Application and specify a name (in the sample code, we have called this project consumer) and location for your project files.



Whenever you create a new project, a default form is added and to that form we need to add the Crystal Report Viewer. You can drag or draw the viewer onto your form and set any additional properties, methods, and events required. Here we have set the Dock property to Fill.

To bind the Crystal Report Viewer to your Report Web Service, you will need to set the ReportSource property in the New event (as shown below using the URL from our earlier example):


CrystalReportViewer1.ReportSource =
"http://localhost/webservice1/inventory_reportService.asmx"

With the ReportSource property set, you can treat this just like any other report, setting properties for the viewer and previewing the report, which is shown below:





Internal Report Web Service


An internal report Web Service refers to a Web Service that has been added to your project as a reference. This method is sometimes also called the "Proxy Method", because every application that consumes a web service has to have a way to communicate with the service when the application is running. Adding a reference to your Report Web Service creates a Proxy Class that in turn can communicate with the service and create a local copy.

To add the XML Report Web Service to your Web or Windows application, select Project | Add Web Reference to open the dialog shown below.


Using this dialog, enter the complete URL of your Report Web Service and click OK, and this will add this reference to your project in the Project Explorer under Web References.

To bind an internal report web service to the Windows Crystal Report viewer, you will again need to set the report source, only this time using the reference you have added instead of a URL. For example:


CrystalReportViewer1.ReportSource = New localhost.inventory_reportService()

From that point, all of the techniques you learned in Chapters 3 and 4 can be applied to the Report Viewer to customize how your report is presented.




Generic Report Web Service


To consume a report served through the generic Report Web Service, you will need to add the report from the Server Explorer to your project. In the Server Explorer dialog, under the node marked Crystal Services, navigate to the Server Files branch, where you should be able to see all of the available reports that are within the path specified in your ServerFiles.Config file.

To add a report to your project, simply drag and drop the report onto a Windows or Web form. From that point, you can add the appropriate Crystal Report Viewer to your form and bind the report to the viewer, as shown here:


CrystalReportViewer1.ReportSource = serverFileReport1

All of the properties, methods, and events available in the Crystal Report Viewer can be used from this point.



/ 115