I am using JRC to export reports from my JSP web application.
When I try to export the report I get this message:
"The report you requested requires further information."
And I am prompted with a login screen. When I put in the user name and password the login screen appears again.
When I set exportControl.setEnableLogonPrompt(false); I get the error "Invalid Logon"
I know that my logon information is correct. Is there any other reason why I would get this error?
If this is the wrong place to post this can someone point me to a more suitable forum.
Here is the code I am using:
<%@ page import="com.crystaldecisions.report.web.viewer.ReportExportControl" %>
<%@ page import="com.crystaldecisions.reports.reportengineinterface.JPEReportSourceFactory" %>
<%@ page import="com.crystaldecisions.sdk.occa.report.reportsource.IReportSourceFactory2" %>
<%@ page import="com.crystaldecisions.sdk.occa.report.exportoptions.ExportOptions" %>
<%@ page import="com.crystaldecisions.sdk.occa.report.exportoptions.ReportExportFormat" %>
<%@ page import="com.crystaldecisions.sdk.occa.report.exportoptions.RTFWordExportFormatOptions" %>
<%@ page import="com.crystaldecisions.sdk.occa.report.exportoptions.PDFExportFormatOptions" %>
<%@ page import="com.crystaldecisions.report.web.viewer.*" %>
<%@ page import="com.crystaldecisions.sdk.occa.report.data.*" %>
<%@ page import="com.crystaldecisions.reports.reportengineinterface.JPEReportSourceFactory" %>
<%@ page import="com.crystaldecisions.sdk.occa.report.reportsource.IReportSourceFactory2" %>
<%@ page import="com.crystaldecisions.reports.sdk.ReportClientDocument" %>
<%
try{
/*
*Set the Parameters
*/
//Fields will hold the parameters
Fields fields = new Fields();
//The rpid parameter
ParameterField paramRpid = new ParameterField();
//Each param must have the following two objects
Values rpidValue = new Values();
ParameterFieldDiscreteValue rpidDValue = new ParameterFieldDiscreteValue();
//Set the parameter name and value
paramRpid.setName("rpid");
//empty name means the main report
paramRpid.setReportName("");
rpidDValue.setValue("1763");
rpidDValue.setDescription("Report parameter Id");
rpidValue.add(rpidDValue);
paramRpid.setCurrentValues(rpidValue);
fields.add(paramRpid);
/*
*End Set Parameters
**/
/**Set Database login info*/
ConnectionInfos connInfos = new ConnectionInfos();
IConnectionInfo connInfo = new ConnectionInfo();
connInfo.setUserName("user");
connInfo.setPassword("pass");
connInfos.add(connInfo);
/** ENd Set Database login info*/
String report = "/reports/cust_emp_all.rpt";
ReportClientDocument reportClientDoc = new ReportClientDocument();
reportClientDoc.open(report, 0);
Object reportSource = reportClientDoc.getReportSource();
ReportExportControl exportControl = new ReportExportControl();
exportControl.setDatabaseLogonInfos(connInfos);
//Set the parameters
exportControl.setParameterFields(fields);
exportControl.setEnableParameterPrompt(false);
//Set the Export Options
ExportOptions exportOptions = new ExportOptions();
exportOptions.setExportFormatType(ReportExportFormat.PDF);
PDFExportFormatOptions pdfExpOpts = new PDFExportFormatOptions();
exportOptions.setFormatOptions(pdfExpOpts);
exportControl.setReportSource(reportSource);
exportControl.setExportOptions(exportOptions);
exportControl.setEnableLogonPrompt(false);
exportControl.setExportAsAttachment(true);
exportControl.refresh();
exportControl.processHttpRequest(request, response, getServletConfig().getServletContext(), out);
} catch (Exception e) {
out.print("EXXXXXXX:::: " + e.getMessage());
}
%>