5,696,038 members and growing! (13,376 online)
Email Password   helpLost your password?
Languages » XML » Web Services     Intermediate

Publishing Crystal Report as a Web Service

By mysorian

A code walk to expose a Crystal Report as a Web Service.
VB, XML, HTMLWindows, .NET, .NET 1.1, WinXP, ASP.NET, VS.NET2003, IE 6.0, Visual Studio, IE, Dev

Posted: 11 Aug 2004
Updated: 11 Aug 2004
Views: 89,290
Bookmarked: 26 times
Announcements
Loading...



Search    
Advanced Search
Sitemap
6 votes for this Article.
Popularity: 2.72 Rating: 3.50 out of 5
0 votes, 0.0%
1
1 vote, 16.7%
2
3 votes, 50.0%
3
1 vote, 16.7%
4
1 vote, 16.7%
5

Introduction

Web services would be a convenient way of distributing reports, and additional security features can be installed. Being a web service, it is platform neutral and can be accessed from other OS. This 'CodeWalk' is to illustrate the ease with which such such a distribution can be accomplished. The article shows the mechanics of creating a web service, and then it shows how to access this service from a WebForm. This access is not limited to a WebForm, it can also be through a console client, but a different procedure has to be adopted.

On Publishing a Crystal Report as a Web Service

Crystal report as a web service:

Start a new project in Visual Studio [Microsoft Development Environment 2003 Version 7.1.3088]. Choose the web service project template [WebSvc2]. Remove the default file 'service1.asmx'. Import the Crystal Report file into the WebSvc2 folder [ParQry.rpt]. Right click this Crystal Report and pickup 'Publish as web service' from the pop-up menu. Now the service ParQryService.asmx is created. Choose ParQryService.asmx as initial start page and build the solution. Right click and pick up 'View in browser'. You will see the following web page:

On this page, all permitted operations will be listed as shown above. Click on 'Service Description' on this web page, this is the so called '*.wsdl' file, a file that can locate the service: 'http://localhost/WebSVC2/ParQryService.asmx?WSDL'.

The project folder for the web service so created is as shown here:

The Crystal Report published as a service will be available at the website for the above query string.

Testing the functionality of the Web Service

Web Service test rig:

Create a web application [WebSvc2Test]. To the WebForm1.aspx, add a CrystalReportViewer control from the tool box. Add a Button to the page, set Text property of the Button to 'Test Web Crystal Service'. Make some changes to the properties of the CrystalReportViewer1 as shown in this screen shot.

To the Button's Click event, add the following code:

Private Sub Button1_Click(ByVal sender As System.Object, _
          ByVal e As System.EventArgs) Handles Button1.Click
    CrystalReportViewer1.ReportSource = _
     "http://localhost/WebSVC2/ParQryService.asmx"
End Sub

This sets up the source for the CrystalReportViewer to be fed from the web service called 'ParQryService', on the localhost web site. Build the solution and view the page on the browser. The browser page on loading will appear as in this picture:

Now, click the button and you will be getting the Crystal Report published as a service on the local host, as shown here:

Crystal Report from Web Service

Now, the overall folder structure of the test rig project is shown here:

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

mysorian


Worked in the area of electrical discharges, high energy lasers, high voltage technology, plasma technology, lithography, thin film plastics, superconducting thin films, diamond thin films, electron accelerators, and free electron lasers for several years. Mentored/guided MS and PhD students at several universities in USA, Brazil, Australia, and India.
Reading books and photography are my hobbies.

Also trained workforce clients with legacy computer skills in web related technologies.

I recently authored a beginner level book on MS SQL Server Integration Services. Details available at the following link:

http://www.packtpub.com/sql-server-integration-services-visual-studio-2005/book
Occupation: Web Developer
Company: Hodentek
Location: United States United States

Other popular XML articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 25 of 31 (Total in Forum: 31) (Refresh)FirstPrevNext
QuestionCrystal Reports Web Service Return PDF Streammemberabiondo11:41 12 Apr '07  
AnswerRe: Crystal Reports Web Service Return PDF Streammembermysorian12:28 12 Apr '07  
QuestionUse in WinFormsmemberthe bill23:29 19 Mar '07  
AnswerRe: Use in WinFormsmembermysorian3:28 20 Mar '07  
GeneralError when consuming Report from a webservicemembermew_lobo17:42 16 Jul '06  
GeneralRe: Error when consuming Report from a webservicemembermysorian18:18 16 Jul '06  
GeneralRe: Error when consuming Report from a webservicemembermew_lobo22:44 16 Jul '06  
QuestionPublish Crystal Reports to WebmemberDoug729:28 6 Mar '06  
AnswerRe: Publish Crystal Reports to Webmembermysorian10:07 6 Mar '06  
GeneralRe: Publish Crystal Reports to WebmemberDoug7211:09 6 Mar '06  
GeneralRe: Publish Crystal Reports to Webmemberitmanager881513:00 26 May '08  
GeneralRe: Publish Crystal Reports to Webmembermysorian13:08 26 May '08  
GeneralLive Datamembercman19736:30 7 Oct '05  
GeneralRe: Live Datamembermysorian6:37 7 Oct '05  
GeneralRe: Live Datamembercman19736:50 7 Oct '05  
GeneralRe: Live Datamembermysorian7:07 7 Oct '05  
GeneralRe: Live Datamembercman19737:13 7 Oct '05  
Generalhi,crystal web servicesussAnonymous2:22 28 Jul '05  
GeneralRe: hi,crystal web servicemembermysorian3:00 28 Jul '05  
GeneralRe: hi,crystal web servicememberm.sreenivas1:20 22 Aug '07  
GeneralRe: hi,crystal web servicememberNarayanan Dayalan2:32 13 Sep '07  
Generalruntime customizationsussBobbyKumar6:49 18 Feb '05  
GeneralRe: runtime customizationmembermysorian7:25 18 Feb '05  
GeneralMove on CredentialsmemberSDSimonsen5:16 27 Oct '04  
GeneralRe: Move on Credentialsmembermysorian10:50 27 Oct '04  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 11 Aug 2004
Editor: Smitha Vijayan
Copyright 2004 by mysorian
Everything else Copyright © CodeProject, 1999-2008
Web07 | Advertise on the Code Project