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

Java Rest_v2 execution Report doesn't produce the pdf file


f.bonavia
Go to solution Solved by plambert_1,

Recommended Posts

Hi to all,

 

I have created a report using TIBCO Jaspersoft Studio named report_con_query_interna.jrxml

 

Then I've deployed it on Jasper Server running on my PC and path and ID resource are:

Path: /reports/ReportConQuerySuDatabase

ID resource: ReportConQuerySuDatabase

 

Now I have created a client JAVA that executes the report.

The Java code is:

 

public String executeReport() {

        String REPORT_RAW = "{"reportUnitUri":"/reports/ReportConQuerySuDatabase", "async":"true", "freshData":"true", "saveDataSnapshot":"true", "outputFormat": "pdf", "interactive":"true", "ignorePagination":"false"}";

System.out.println("executing a report");

    //building the request parameters

    List<NameValuePair> ce_qparams = new ArrayList<NameValuePair>();

    ce_qparams.add(new BasicNameValuePair("j_username", "jasperadmin"));

    ce_qparams.add(new BasicNameValuePair("j_password", "jasperadmin"));

   

    try {

    HttpPost httpReqPost = new HttpPost();

   

    // set header

    httpReqPost.setHeader("Accept", "application/json");

    httpReqPost.setHeader("Content-type", "application/json");

   

    HttpEntity entity = new ByteArrayEntity(REPORT_RAW.getBytes("UTF-8"));

   

    String result = getStringFromInputStream(entity.getContent());

    System.out.println("payload: " + result);

   

       httpReqPost.setEntity(entity);

   

    //System.out.println("RESOURCE_REPORT_EXECUTIONS: " + RESOURCE_REPORT_EXECUTIONS);

    httpRes = sendRequest(httpReqPost, RESOURCE_REPORT_EXECUTIONS, ce_qparams, true);

 

    System.out.println("http response: " + httpRes.toString());

    result = getStringFromInputStream(httpRes.getEntity().getContent());

    System.out.println("descriptor: " + result);

   

    return result;

   

    }

    catch (Exception e) {

e.printStackTrace();

return null;

}

}

 

System.out.println are:

 

payload: {"reportUnitUri":"/reports/ReportConQuerySuDatabase", "async":"true", "freshData":"true", "saveDataSnapshot":"true", "outputFormat": "pdf", "interactive":"true", "ignorePagination":"false"}

 

http response: HTTP/1.1 200 OK [server: Apache-Coyote/1.1, P3P: CP="ALL", Set-Cookie: userLocale=en_US;Expires=Wed, 3-Feb-2016 16:19:31 GMT;HttpOnly, Content-Type: application/json, Transfer-Encoding: chunked, Date: Tue, 02 Feb 2016 16:19:31 GMT]

 

descriptor: {"status":"queued","requestId":"960ba085-ce1e-44ff-a972-bb4489f38710","reportURI":"/reports/ReportConQuerySuDatabase","exports":[{"id":"f5d091d8-be7d-476a-a00b-f5f41cae2dcb","status":"queued"}]}

 

Where is saved the file pdf produced by the execution of this report ?

 

Thanks,

Francesco

Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

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