Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

VS.Net working example of Web Services in Crystal Server 2008?

I've been beating my head against the wall trying to figure this out but to no avail.

Summary: I have a Crystal Reports 2008 Report with two parameters reporting on a SQL 2005 express database in a Crystal Reports Server 2008. The report works fine when I execute it in Crystal Reports 2008 and in Crystal Reports Server 2008. When I try to access it in Crystal Reports Server 2008 from a VS 2005 project using a web service I get an parameter error. It seems to work fine if parameters are suppressed.

I've setup up 3 machines with XP SP3.

Machine 1:

Crystal Reports Server 2008 (default install with enterprise logon)

Machine 2:

Crystal Reports 2008

Machine 3

VS2005 SP1

SQL2005 Express (latest sp)

I've created a table TestTable (TestTableID int, TestTableName nvarchar(200))

I've created a stored procedure called TestGet(Select TestTableID, TestTableName From TestTable Where TestID = @intTestID)

I've created a report on Machine 2 using OLEDB to connect to Machine 3.

I've uploaded the report to the Crystal Report Server 2008 and modified the database logon so it doesn't prompt me.

The report works in Crystal Reports 2008 and Crystal Reports Server 2008.

The report has two parameters. (TestID and DummyParam1)

I've created a new web site in VS2005.

I added:

BusinessObjects.DSWS.BICatalog.dll

BusinessObjects.DSWS.BIPlatform.dll

BusinessObjects.DSWS.dll

BusinessObjects.DSWS.LiveOffice.dll

BusinessObjects.DSWS.Publish.dll

BusinessObjects.DSWS.QueryService.dll

BusinessObjects.DSWS.ReportEngine.dll

BusinessObjects.DSWS.SaveService.dll

BusinessObjects.DSWS.Session.dll

All files have a File Version of 12.0.2000.683

I'm using code from Ted Ueda (Thanks Ted) and modified it for my own use:

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using BusinessObjects.DSWS;
using BusinessObjects.DataSource;
using BusinessObjects.Query;
using BusinessObjects.DSWS.Session;
using BusinessObjects.DSWS.BIPlatform;
using BusinessObjects.DSWS.ReportEngine;
using BusinessObjects.DSWS.BIPlatform.Constants;


public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {

        // Document path
        //string crPath = FixedPaths.InfoObjects.ROOT_FOLDER + "/302782727/302782727_sp@SI_ID";
        string crPath = "path://InfoObjects/Root Folder/WWE Reports/CR2008_OLEDB_test_SP2_nodata";
        // Enterprise Web Services URL and Login Credentials.
        //string boSessionURL = "http://tueda-bexir2s2:8080/dswsbobje/services/session";
        string boSessionURL = "http://192.168.1.146:8080/dswsbobje/services/Session";

        //string boCMSName = "TUEDA-BEXIR2S2";
        string boCMSName = "myorgani-1cf481";
                            
        string boAuthType = "secEnterprise";
        string boUsername = "Administrator";
        //string boPassword = "";
        string boPassword = "myDatabase";

        Session boSession = null;
        try
        {

            // Logon to Enterprise

            EnterpriseCredential boCredential = new EnterpriseCredential();
            boCredential.Domain = boCMSName;
            boCredential.AuthType = boAuthType;
            boCredential.Login = boUsername;
            boCredential.Password = boPassword;

            boSession = new Session(new Connection(boSessionURL));
            boSession.Login(boCredential);

            // Retrieve Document CUID

            BIPlatform biPlatform
                = BIPlatform.GetInstance(boSession, boSession.GetAssociatedServicesURL("BIPlatform")[0]);

            ResponseHolder rh = biPlatform.Get(crPath, null);

            string doc_cuid = rh.InfoObjects.InfoObject[0].CUID;

            // Retrieve ReportEngine service.

            ReportEngine reportEngine
                = ReportEngine.GetInstance(boSession, boSession.GetAssociatedServicesURL("ReportEngine")[0]);

            // Refresh document and retrieve the prompts.

            RetrieveMustFillInfo retrieveInfo = new RetrieveMustFillInfo();
            retrieveInfo.RetrievePromptsInfo = new RetrievePromptsInfo();

            DocumentInformation doc
                    = reportEngine.GetDocumentInformation(doc_cuid, null, new Action[] { new Refresh() }, null, null);
            string docRef = doc.DocumentReference;


            doc = reportEngine.GetDocumentInformation(docRef, retrieveInfo, null, null, null);
            docRef = doc.DocumentReference;

            int promptCount = doc.PromptInfo == null ? 0 : doc.PromptInfo.Length;

            FillPrompt[] fillPromptList = new FillPrompt[promptCount];

            int i = 0;
            foreach (PromptInfo promptInfo in doc.PromptInfo)
            {
                fillPromptList<i> = new FillPrompt();
                fillPromptList<i>.ID = promptInfo.ID;

                DiscretePromptValue dvalue1, dvalue2;

                dvalue1 = new DiscretePromptValue();
                dvalue1.Value = "5";
                fillPromptList<i>.Values = new PromptValue[] { dvalue1 };
                i++;
                Response.Write(promptInfo.ID + "<BR>");
            }

            FillPrompts fillPrompts = new FillPrompts();
            fillPrompts.FillPromptList = fillPromptList;

            doc = reportEngine.GetDocumentInformation(docRef, null, new Action[] { fillPrompts }, null, null);
            docRef = doc.DocumentReference;

            retrieveInfo = new RetrieveMustFillInfo();
            retrieveInfo.RetrieveDBLogonInfo = new RetrieveDBLogonInfo();

            doc = reportEngine.GetDocumentInformation(docRef, retrieveInfo, null, null, null);
            docRef = doc.DocumentReference;

            DBLogonInfo[] dbLogonInfos = doc.DBLogonInfos;

            FillDBLogon[] dbLogon = new FillDBLogon[1];
            dbLogon[0] = new FillDBLogon();
            dbLogon[0].Name = dbLogonInfos[0].Name;
            dbLogon[0].UserName = "vantech";
            dbLogon[0].Password = "vantech";


            FillDBLogons dbLogons = new FillDBLogons();
            dbLogons.FillDBLogonList = dbLogon;

            doc = reportEngine.GetDocumentInformation(docRef, null, new Action[] { dbLogons } , null, null);
            docRef = doc.DocumentReference;

            RetrieveData retrieveData = new RetrieveData();
            RetrieveView retrieveView = new RetrieveView();

            ViewSupport viewSupport = new ViewSupport();
            viewSupport.OutputFormat = OutputFormatType.HTML;
            viewSupport.ViewType = ViewType.CHARACTER;
            viewSupport.ViewMode = ViewModeType.REPORT_PAGE;

            retrieveView.ViewSupport = viewSupport;
            retrieveData.RetrieveView = retrieveView;

            doc = reportEngine.GetDocumentInformation(docRef, null, null, null, retrieveData);
            docRef = doc.DocumentReference;
            String content = ((CharacterView)doc.View).Content;

            // Close document connection.
            doc = reportEngine.GetDocumentInformation(docRef, null, new Action[] { new Close() }, null, null);

            // Output view to web browser.
            Response.Write(content);



        }
        catch (DSWSException ex)
        { Console.WriteLine(ex); }
        finally
        {

            if (boSession != null)
                boSession.Logout();

        }

    }

}

When I run it I get an error at the line:

doc = reportEngine.GetDocumentInformation(docRef, retrieveInfo, null, null, null);

With the error:

{"Failed to retrieve database logon info. Information is needed before this report can be processed. (WRE 02517)"}
    base {System.Exception}: {"Failed to retrieve database logon info. Information is needed before this report can be processed. (WRE 02517)"}
    CallStackTrace: "com.crystaldecisions.sdk.occa.report.lib.ReportSDKParameterFieldException: Information is needed before this report can be processed.---- Error code:-2147213303 Error code name:invalidParameterField\n\tat com.crystaldecisions.sdk.occa.report.lib.ReportSDKParameterFieldException.throwReportSDKParameterFieldException(Unknown Source)\n\tat com.crystaldecisions.sdk.occa.managedreports.ps.internal.f.a(Unknown Source)\n\tat com.crystaldecisions.sdk.occa.managedreports.ps.internal.f.getPromptDatabaseLogOnInfos(Unknown Source)\n\tat com.businessobjects.dsws.wsc.reportengine.Report.getDBLogonsInfo(Unknown Source)\n\tat com.businessobjects.dsws.wsc.reportengine.DocumentAgent.handleRetrieveMustFillInfo(Unknown Source)\n\tat com.businessobjects.dsws.wsc.reportengine.DocumentAgent.handleActions(Unknown Source)\n\tat com.businessobjects.dsws.wsc.reportengine.CrystalReportEngineSoapImpl.getDocumentInformation(Unknown Source)\n\tat com.businessobjects.dsws.reportengine.ReportEngineSoapImpl.getDocumentInfo
rmation(Unknown Source)\n\tat com.businessobjects.dsws.reportengine.ReportEngineSkeleton.getDocumentInformationByMTOM(Unknown Source)\n\tat com.businessobjects.dsws.reportengine.ReportEngineMessageReceiverInOut.invokeBusinessLogic(Unknown Source)\n\tat org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:42)\n\tat org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:96)\n\tat org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:145)\n\tat org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)\n\tat org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:120)\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:709)\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:802)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)\n\tat org.apache.catalina.core.ApplicationFilterChain.do
Filter(ApplicationFilterChain.java:173)\n\tat com.businessobjects.dsws.wsc.common.axis.FlashFilter.doFilter(Unknown Source)\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)\n\tat org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)\n\tat org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)\n\tat org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)\n\tat org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)\n\tat org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)\n\tat org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)\n\tat org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)\n\tat org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11Base
Protocol.java:664)\n\tat org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)\n\tat org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)\n\tat org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)\n\tat java.lang.Thread.run(Thread.java:595)\n"
    CauseDetail: "Information is needed before this report can be processed."
    CauseException: "com.crystaldecisions.sdk.occa.report.lib.ReportSDKParameterFieldException"
    CauseID: null
    CauseMessage: "Information is needed before this report can be processed."
    ID: "2517"
    Message: "Failed to retrieve database logon info. Information is needed before this report can be processed. (WRE 02517)"
    Operation: "reportengine.dsws.businessobjects.com/getDocumentInformation"
    WebServiceID: ""
	

I've tried several variations of this and I don't think I'm doing anything too exotic so... does anyone have an example of this working? It seems to work if I don't put any parameters in but it dies when I do.

Any help would be hugely appreciated.

Thanks in advance,

j

Former Member
Not what you were looking for? View more on this topic or Ask a question