Click here to Skip to main content
11,428,876 members (60,756 online)
Click here to Skip to main content

Publishing Crystal Report as a Web Service

, 11 Aug 2004
Rate this:
Please Sign up or sign in to vote.
A code walk to expose a Crystal Report as a Web Service.

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

Share

About the Author

mysorian
Technical Writer Hodentek
United States United States
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

My second book was released in 2008
Learn SQL Server Reporting Services 2008

Get book details at the following site:
http://www.packtpub.com/learning-sql-server-2008-reporting-services/book

This is for anyone who is interested in Reporting Services a la Microsoft. It has over 50 hands-on exercises and covers all aspects of Reporting Services.

Recent new books:

Microsoft SQL Azure Enterprise Application Development 2010
-A Comprehensive book on SQL Azure

Microsoft Visual Studio LightSwitch Business Application Development 2011
A step-by-step approach that is sure to work

Learning SQL Server Reporting Services 2012 Packt Publishers, ISBN: 978-1-84968-992-2 , 2013
Follow on   Twitter   LinkedIn

Comments and Discussions

 
QuestionShowing Graphs... Pin
shiber1222-Feb-09 22:00
membershiber1222-Feb-09 22:00 
QuestionCrystal Reports Web Service Return PDF Stream Pin
abiondo12-Apr-07 11:41
memberabiondo12-Apr-07 11:41 
AnswerRe: Crystal Reports Web Service Return PDF Stream Pin
mysorian12-Apr-07 12:28
membermysorian12-Apr-07 12:28 
QuestionUse in WinForms Pin
the bill19-Mar-07 23:29
memberthe bill19-Mar-07 23:29 
AnswerRe: Use in WinForms Pin
mysorian20-Mar-07 3:28
membermysorian20-Mar-07 3:28 
GeneralError when consuming Report from a webservice Pin
mew_lobo16-Jul-06 17:42
membermew_lobo16-Jul-06 17:42 
GeneralRe: Error when consuming Report from a webservice Pin
mysorian16-Jul-06 18:18
membermysorian16-Jul-06 18:18 
GeneralRe: Error when consuming Report from a webservice Pin
mew_lobo16-Jul-06 22:44
membermew_lobo16-Jul-06 22:44 
QuestionPublish Crystal Reports to Web Pin
Doug726-Mar-06 9:28
memberDoug726-Mar-06 9:28 
Regards,
I´m trying to deploy my web application in a shared hosting place, but the Crystal Report XI pages does not work. I read your article and tried to do that as a web service, but it is not still working.
Have you ever tried to use Crystal Report to do this? Is that even possible? If so, what are the steps to follow up?
Thanks in advance for any help that you can offer.

Douglas Borrero
AnswerRe: Publish Crystal Reports to Web Pin
mysorian6-Mar-06 10:07
membermysorian6-Mar-06 10:07 
GeneralRe: Publish Crystal Reports to Web Pin
Doug726-Mar-06 11:09
memberDoug726-Mar-06 11:09 
GeneralRe: Publish Crystal Reports to Web [modified] Pin
itmanager881526-May-08 13:00
memberitmanager881526-May-08 13:00 
GeneralRe: Publish Crystal Reports to Web Pin
mysorian26-May-08 13:08
membermysorian26-May-08 13:08 
GeneralLive Data Pin
cman19737-Oct-05 6:30
membercman19737-Oct-05 6:30 
GeneralRe: Live Data Pin
mysorian7-Oct-05 6:37
membermysorian7-Oct-05 6:37 
GeneralRe: Live Data Pin
cman19737-Oct-05 6:50
membercman19737-Oct-05 6:50 
GeneralRe: Live Data Pin
mysorian7-Oct-05 7:07
membermysorian7-Oct-05 7:07 
GeneralRe: Live Data Pin
cman19737-Oct-05 7:13
membercman19737-Oct-05 7:13 
Generalhi,crystal web service Pin
Anonymous28-Jul-05 2:22
sussAnonymous28-Jul-05 2:22 
GeneralRe: hi,crystal web service Pin
mysorian28-Jul-05 3:00
membermysorian28-Jul-05 3:00 
GeneralRe: hi,crystal web service Pin
m.sreenivas22-Aug-07 1:20
memberm.sreenivas22-Aug-07 1:20 
GeneralRe: hi,crystal web service Pin
Narayanan Dayalan13-Sep-07 2:32
memberNarayanan Dayalan13-Sep-07 2:32 
Generalruntime customization Pin
BobbyKumar18-Feb-05 6:49
sussBobbyKumar18-Feb-05 6:49 
GeneralRe: runtime customization Pin
mysorian18-Feb-05 7:25
membermysorian18-Feb-05 7:25 
GeneralMove on Credentials Pin
SDSimonsen27-Oct-04 5:16
memberSDSimonsen27-Oct-04 5:16 
GeneralRe: Move on Credentials Pin
mysorian27-Oct-04 10:50
membermysorian27-Oct-04 10:50 
GeneralExporting report output in different format Pin
Anonymous27-Sep-04 5:34
sussAnonymous27-Sep-04 5:34 
GeneralRe: Exporting report output in different format Pin
mysorian27-Sep-04 6:55
membermysorian27-Sep-04 6:55 
Generalpassing parameter Pin
codefranz20-Aug-04 6:51
membercodefranz20-Aug-04 6:51 
QuestionRe: passing parameter Pin
Carl B i know nothing11-Jun-07 6:32
memberCarl B i know nothing11-Jun-07 6:32 
QuestionParQry.rpt? Pin
jjsj18-Aug-04 11:39
memberjjsj18-Aug-04 11:39 
AnswerRe: ParQry.rpt? Pin
mysorian27-Sep-04 6:32
membermysorian27-Sep-04 6:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150428.2 | Last Updated 12 Aug 2004
Article Copyright 2004 by mysorian
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid