Skip to Content
avatar image
Former Member

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".

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!!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Oct 30, 2015 at 06:24 PM

    Post it in SDK forum for faster response.

    Java SDK Application Development

    Add comment
    10|10000 characters needed characters exceeded