Skip to Content

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

How to export Crystal Report using BOXI 4 Web Services

Hi Forum,

We have a custom Java web app, from where the user can launch BOXI reports. Behind the scenes, a servlet does the following:

a. connect with BOXI server

b. Pass on the values chosen by the user

c. Retrieve report

d. Display report in PDF format on the browser

Our BOXI setup was upgraded from BOXI 3 to BOXI 4 and since then this functionality does not work.

So far, I have been able to connect to BOXI 4server, get a session and retrieve the report ID. How can I next export this report in a PDF format?

I tried downloading the file and then writing the stream to both a local file object and the servlet's response stream. Both dont work.

The file gets created. But when I try opening the pdf file, I get the error:"Adobe could not open the file because it is either not a supported file type or because the file has been damaged".

Note: I skipped passing the prompts to first get the report to download. Could that be the problem?

I could find no sample code for exporting a report using Web Services. I only see Webi examples, but I need Web Services

Help please? (My code below)

ResponseHolder rh;

String servicesURL = "http://<server>:8080/dswsbobje/services/

Connection oConnection = new Connection(new URL(servicesURL+"session"));

//set credentials

EnterpriseCredential oEnterpriseCredential = EnterpriseCredential.Factory.newInstance();





//get session

oSession = new Session(oConnection);


//connect to BIPlatform

oConnection.setURL(new URL(servicesURL+"biplatform"));

BIPlatform oBIPlatform = new BIPlatform(oConnection,oSession.getConnectionState());

GetOptions oGetOptions = GetOptions.Factory.newInstance();


//set report Path

String path = "path://InfoObjects/Root Folder/"+properties.getString("REPORT_PATH")+reportName;

//get report to response holder

rh = oBIPlatform.get(path, null);

InfoObjects infoObjects = rh.getInfoObjects();

if (infoObjects == null || infoObjects.getInfoObjectArray().length == 0){

                  System.out.println("Failed to find report: " + reportName);



//get report ID

InfoObject reportInfoObject = infoObjects.getInfoObjectArray(0);

String reportCUID = reportInfoObject.getCUID();

int reportID = reportInfoObject.getID();


//next I tried both writing the report to a file as well as to the response stream. Both are not working!

//set response values


response.addHeader("Content-Disposition", "inline;filename=" + reportName +".pdf"); os = response.getOutputStream();

//start downloading report

String downloadID = oBIPlatform.startSingleDownload(reportCUID, 0, null);

//file object newFileObj = new;




newFileObj.createNewFile(); fileOutputStream = new;

//download the report

DownloadStatus status = oBIPlatform.downloadFile(downloadID, Long.valueOf("0"));

//write stream to file object and response



//continue file writing



                  oBIPlatform.downloadFile(downloadID, Long.valueOf(status.getNextReferencePosition()));        

                  System.out.println("Writing.." + status.getBinaryData());

                  fileOutputStream.write(status.getBinaryData()); //write tofile

                  os.write(status.getBinaryData()); //write to response


//close streams




Any help please!!

Former Member

Hi Rose,

from your code, you are actually downloading the RPT binary.  To get a PDF, you can schedule the report to PDF and then download the scheduled instance.


0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question