It's all about the answers!

Ask a question

Unable to to upload a RPE report using the API

Russell Norlund (17211621) | asked Feb 16 '18, 2:29 a.m.

 Hi Folks, when I try upload a RPE report to RTC using the API, I get the following error message:

'An error ocurred during "Save Report Resource". Report contents are invalid. Cause: invalid CEN header (bad signature)'

The following code fragment may help in understanding this behaviour:

public String replaceReports(IProjectArea prj, String strReportIdentifier, String strRptdesignFilePath, String strDescription) {
IReportManager reportManager = (IReportManager) repo.getClientLibrary(IReportManager.class);
try {
if (!reportManager.doesReportDescriptorExist(prj, strReportIdentifier, null))
return "not found";

//Replace the Report descriptor
IReportDescriptor reportDescriptor = reportManager.fetchReportDescriptor(prj.getItemId().getUuidValue(), strReportIdentifier, null);
InputStream inStream = new FileInputStream(strRptdesignFilePath);
String strContentType ;
IContent newContent = repo.contentManager().storeContent("application/octet-stream", convertStreamToString(inStream), null);
reportDescriptor = (IReportDescriptor) reportDescriptor.getWorkingCopy();
reportDescriptor.setDesignContent("dta", newContent);
reportManager.saveReportDescriptor(reportDescriptor, null);

I have the following questions:
1. Is the content type correct i.e. "application/octet-stream" ? NB using "text/Plain" seems to work fine for BIRT reports but not for RPE reports.
2. Is this technically possible?

Be the first one to answer this question!

Register or to post your answer.