[Java] Using asynchronous mode in different java session instance

0

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();
 
        }

Regards

Simon

simon.devineau's picture
Joined: Feb 12 2015 - 9:34am
Last seen: 4 years 9 months ago

0 Answers:

No answers yet
Feedback
randomness