Jump to content
We've recently updated our Privacy Statement, available here ×

[Java] Using asynchronous mode in different java session instance


simon.devineau

Recommended Posts

Hello,

I am developing a Java webservices to call your webservices and execute report.

I would like to run report asyncronously and get the report later (15 min for example).

My problem is, accoding to your tutorial,  you need to retrieve report from the same java session instance.

I would like to know if it is possible to retrieve a report by creating a new session but with the same info (sessionId etc ..). I cannot save the java session instance but i can save the sessionID.

//Runa report   Session session = JasperClient.getInstance().authenticate(LOGIN, PASSWORD);ReportExecutionRequest request = new ReportExecutionRequest();        request.setReportUnitUri(TEST_REPORT);        request.setAsync(true).setOutputFormat(OutputFormat.PDF.toString());        OperationResult<ReportExecutionDescriptor> operationResult = session.reportingService()                .newReportExecutionRequest(request);        return operationResult.getEntity();// I have the requestId now//later in the time         Session session = JasperClient.getInstance().authenticate(LOGIN, PASSWORD);//It is a different session, so it won't work//How should I do ?        ReportingService reportingService = session.reportingService();        ReportExecutionRequestBuilder reportExecutionRequest = reportingService                .reportExecutionRequest(reportExecutedDescriptor.getRequestId());        List<ExportDescriptor> exports = reportExecutedDescriptor.getExports();        if (exports != null && exports.size() > 0) {            String exportId = exports.get(0).getId();            ExportExecutionRequestBuilder export = reportExecutionRequest.export(exportId);            OperationResult<InputStream> operationResult = export.outputResource();            return operationResult.getEntity();        }[/code]

 

Regards

 

Simon

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...