cancel
Showing results for 
Search instead for 
Did you mean: 

Unmanaged RAS in .NET doesn't work.

Former Member
0 Kudos

I've been studying the KB articles and looking through some forum posts here, but I can't get a simple .NET app working with unmanaged RAS API. Everything I tried keeps telling me that I need the RAS server running. I don't understand if this is unmanaged RAS, then I don't have a RAS server to go against. I assume that maybe there is a RAS service running in the background, but I don't know. I've also downloaded the online .NET RAS samples, but they crash too. Here is what I've done:

Install VS.NET 2008

Install CR 2008

Install CR 2008 SP0

I built a very simple application using some of the sample code as a base, and here is what I have:

private void OpenSampleReport_unmanagedRAS()

{

string sampleReportPath = @"C:\Employee Profile.rpt";

object path = (object)sampleReportPath;

ReportDocument rd = new ReportDocument();

ISCDReportClientDocument rcd = new ReportClientDocumentClass();

rd.Load(sampleReportPath);

rcd.ReportAppServer = "localhost";

//Error on next line: 'The ReportClientDocument property can only be accessed when the

//report is opened using a Report Application Server.

rcd = rd.ReportClientDocument;

crystalReportViewer1.ReportSource = rd;

}

-


Here is what happens when I run a sample report from the BOBJ site (NewReport.sln). Here is a code snippet:

void CreateReport()

{

// create a report client document

m_crReportDocument = new ReportClientDocument();

m_crReportDocument.ReportAppServer = "127.0.0.1";

// initiate new report

//Error on next line: "Failed to connect to server "127.0.0.1"

m_crReportDocument.New();

// create ODBC connection

m_crConnectionInfo = CreateConnectionInfo();

As you can see, it expects me to be running a RAS server on my localhost, but this doesn't appear to be the case. Do I need to turn on a RAS service after installing CR 2008 SP0? Do I need to run a separate install for the RAS? Is there a way to see if a RAS service is running (I don't see it listed under Windows Services).

Again, this is for unmanaged RAS and a thick client application so that I can modify reports using from within my Windows application.

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

former_member184995
Active Contributor
0 Kudos

Hi Brian,

There pretty much is no such thing as unmanaged RAS any longer. It quit shipping with CR after version 10. It was a stand alone RAS server that ran without being included in the Enterprise product.

What you are talking about is inprocess RAS.

RAS is included inproc in XI R2 SP2 and above and CR 2008 which means there is no seperate RAS server.

Here is how to create the reportclientdocument object from the reportdocument object using inproc RAS.

Give this simple code a try and let me know if it works. This at least shows how to get to the reportclientdocument object. In my opinion only reason to use RAS inproc is if you want to use the RCAPI abilities of RAS. If you aren't then using the ReportDocument is fine.

private void OpenSampleReport_InprocRAS()

{

string sampleReportPath = @"C:\Employee Profile.rpt";

ReportDocument rd = new ReportDocument();

rd.Load(sampleReportPath);

ISCDReportClientDocument rcd = new ReportClientDocumentClass();

rcd = rd.ReportClientDocument

crystalReportViewer1.ReportSource = rcd;

}

I hope this helps!

Jason

Former Member
0 Kudos

Thanks Jason,

I copied your code and on this line:

rcd = rd.ReportClientDocument;

I get the error:

"The ReportClientDocument property can only be accessed when the report is opened using a Report Application Server".

Is there another property that it should be assigned to so that it can be loaded into the rcd? According to the following page (http://msdn.microsoft.com/en-us/library/ms225229.aspx) , it says, "...by setting two properties on any given report instance, and the underlying ReportClientDocument object model can now be accessed directly...." So what are those two properties that must be set to do this? I don't see them specified anywhere.

Brian

former_member184995
Active Contributor
0 Kudos

That is strange.

In VB.NET I have a working application that looks like:

boReportDocument = New CrystalDecisions.CrystalReports.Engine.ReportDocument

boReportDocument.Load(Server.MapPath("World Sales Report.rpt"))

'Instantiate the Report Client Document from the report

Dim boReportClientDocument As ISCDReportClientDocument

boReportClientDocument = boReportDocument.ReportClientDocument

and it works fine.

I have not tried it with CR2008 yet though.

I will try it out later if I get a chance.

Jason

ted_ueda
Employee
Employee
0 Kudos

I'd check to see if your project is still referencing the Crystal Reports Basic for Visual Studio 2008 rather than Crystal Reports .NET 2008 assemblies. The former has assembly version 10.* and the latter 12.*.

I've used CR.NET 2008 inproc RAS in VS 2008, sample code here:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.ReportAppServer.ClientDoc;
using CrystalDecisions.ReportAppServer.CommonObjectModel;
using CrystalDecisions.ReportAppServer.Controllers;
using CrystalDecisions.ReportAppServer.DataDefModel;
using CrystalDecisions.ReportAppServer.DataSetConversion;
using CrystalDecisions.ReportAppServer.ReportDefModel;
using CrystalDecisions.Shared;
using System.Data;
using System.IO;

namespace ExportToPDF
{
    class Program
    {
        static void Main(string[] args)
        {
            string xmlFilePath;
            string rptFilePath;
            string pdfFilePath;
            System.Data.DataSet dataSet;
            ISCRDataSet rasDataSet;

            CrystalDecisions.CrystalReports.Engine.ReportDocument reportDocument;
            ISCDReportClientDocument reportClientDocument;
            ISCRTable table;

            System.IO.FileStream fout;
            byte[] bytes;
            
            /*
             * Path to input XML DataSet file and Crystal Report, and output PDF file.
             */
            
            xmlFilePath = new DirectoryInfo(Environment.CurrentDirectory).Parent.Parent.FullName + @"\cal2.xml";
            rptFilePath = new DirectoryInfo(Environment.CurrentDirectory).Parent.Parent.FullName + @"\cal_ueda.rpt";
            pdfFilePath = new DirectoryInfo(Environment.CurrentDirectory).Parent.Parent.FullName + @"\cal_ueda.pdf";

            /*
             * Read ADO.NET XML DataSet and convert to RAS DataSet.
             */

            dataSet = new System.Data.DataSet();
            dataSet.ReadXml(xmlFilePath);
            rasDataSet = DataSetConverter.Convert(dataSet);

            //
            // Fix up rasDataSet here if needed, before injection...
            //
            

            /*
             * Open the Crystal Report .NET (ReportDocument) and then open it in 
             * RAS (ReportClientDocument).
             */

            reportDocument = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
            reportDocument.Load(rptFilePath);
            reportClientDocument = reportDocument.ReportClientDocument;

           /*
             * For simplicity, we assume only a single table in the report.
             */
            table = reportClientDocument.Database.Tables[0];

            /*
             * Inject the RAS DataSet into the report.
             */

            reportClientDocument.DatabaseController.SetDataSource(rasDataSet, table.Alias, rasDataSet.Tables[0].Name);

            // Debug export to rpt file - I use it to check the field types post-change
            string rptOutputFilePath = new DirectoryInfo(Environment.CurrentDirectory).Parent.Parent.FullName + @"\cal_ueda_out.rpt";
            System.IO.FileStream fout_rpt = new System.IO.FileStream(rptOutputFilePath, FileMode.Create);
            byte[] bytes_rpt = reportClientDocument.PrintOutputController.Export(CrReportExportFormatEnum.crReportExportFormatCrystalReports, 0).ByteArray;
            fout_rpt.Write(bytes_rpt, 0, bytes_rpt.Length - 1);
            fout_rpt.Close();

            /*
             * Export to PDF file.
             */

            fout = new System.IO.FileStream(pdfFilePath, FileMode.Create);
            bytes = reportClientDocument.PrintOutputController.Export(CrReportExportFormatEnum.crReportExportFormatPDF, 0).ByteArray;
            fout.Write(bytes, 0, bytes.Length - 1);
            fout.Close();

            /*
             * Close Crystal Report and RAS object.
             */

            reportClientDocument.Close();
            reportDocument.Close();
            reportDocument.Dispose();
        }
    }
}

Sincerely,

Ted Ueda

Former Member
0 Kudos

Thanks Ted! Yes, it was a versioning problem. The strange thing is that I built the app after install CR 2008 SP0 and all the DLLs should have been the upgraded version. But they were all old. Now when I create a new app, all the versions are up to date and everything works just fine. Odd.

Thanks again.

Brian

Former Member
0 Kudos

I'm using inproc RAS and using the following code

protected void display_Click(object sender, EventArgs e)

{

reportDocument = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

reportDocument.Load(reportsList.SelectedValue);

ISCDReportClientDocument rcd = new ReportClientDocumentClass();

rcd = reportDocument.ReportClientDocument;

crystalReportViewer.ReportSource = rcd;

}

and i have used the following namespaces:

using CrystalDecisions.CrystalReports.Engine;

using CrystalDecisions.ReportAppServer.ClientDoc;

using CrystalDecisions.ReportAppServer.CommonObjectModel;

using CrystalDecisions.ReportAppServer.Controllers;

using CrystalDecisions.ReportAppServer.DataDefModel;

But when i run the code I receive the following error

"Invalid report Source"

And then when I replace the line

crystalReportViewer.ReportSource = rcd;

with

crystalReportViewer.ReportSource = ReportDocument;

the report opens....but I need to use ISCDReportClientDocument object as I want the reports to be dynamic with the end users being able to edit it at runtime.

How do I resolve this?

Please guide me as I'm kind of stuck up and it is quite urgent.

Former Member
0 Kudos

I somehow resolved the issue by replacing

crystalReportViewer.ReportSource = rcd;

with

crystalReportViewer.ReportSource = rcd.ReportSource;

and now the reports work.But can any1 guide me as to how i can provide a designer for users to drag and drop fields etc. at runtime.

Edited by: meenakshi vaidyanathan on Jul 8, 2008 12:19 PM

Edited by: meenakshi vaidyanathan on Jul 8, 2008 3:24 PM

former_member183750
Active Contributor
0 Kudos

Lots of good samples here:

https://boc.sdn.sap.com/codesamples

Ludek

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello Meenakshi,

for .NET inproc RAS there is still no GUI for an embeddable designer like we used to have it for the RDC / embedded designer.

You would need to porgram this manually.

Please see here [a sample how to create a simple report from scratch|ftp://ftp.businessobjects.com/pub/incoming/CS_CreateReport_inproc_thread_936234.zip] in CS VS 05.

Please post if you need more samples.

Falk

ted_ueda
Employee
Employee
0 Kudos

Hello Brian,

Just some background info, to expand on Jason's message earlier, concerning the Report Application Server (RAS) components - RAS server, inproc RAS, and the RAS SDK.

The RAS Server is a server-side of a server-client architecture for Crystal Report creation/modification/viewing. The RAS server processes requests from the RAS SDK, using the report engine to run reports. Connection between RAS server and RAS SDK is via CORBA - TCP/IP.

The RAS Server can run in two versions: stand-alone or as part of Enterprise (Crystal Enterprise, Crystal Reports Server or BusinessObjects Enterprise). Current stand-alone version (Crystal Reports Server XI Release 2 Embedded) is a OEM/Parter only solution.

As part of Enterprise, RAS can be used for "managed reporting" or "unmanaged reporting".

With stand-alone or unmanaged reporting, the RAS accesses the rpt file directly, where the rpt file is deployed on the RAS server (you'd reference it by its physical path) or on the application server running the RAS SDK (you'd reference it via URL "rassdk://<physical path here>").

With managed reporting, the RAS accesses reports that are managed by the Enterprise system (you'd reference report by their SI_ID value on Enterprise).

The difference between stand-alone and unmanaged is that unmanaged uses Enterprise authentication - it uses the Guest account, taking up one CAL license count per report, while stand-alone uses 3 CPL (Concurrent Process License) licensing.

With stand-alone or unmanaged reporting, you'd specify the location of the RAS server in RAS SDK using the ReportAppServer property of the ReportClientDocument.

With managed, you'd request the service from EnterpriseSession.

So what's Inproc RAS? CR.NET uses underlying RAS SDK for its functionality. Rather than connect to a remote RAS server, however, the inproc RAS SDK directly invokes the report engine within the CR.NET process.

The underlying RAS SDK was not exposed for public use until Crystal Reports XI Release 2 Service Pack 2.

This extends functionality of CR.NET in allowing for report creation/modification functionality. Of course, the server-client RAS server is a better scalability fit for applications under more than modest load.

Sincerely,

Ted Ueda