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

jbgauche57

Members
  • Posts

    6
  • Joined

  • Last visited

jbgauche57's Achievements

Rookie

Rookie (2/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. Hey everyone, I'm a student and I have to do a project for the startup I'm working for. This project is based on JasperReport and I have to integrat this solution in their application. I have to add the possibility to schedule a report using their interface, using rest_v2. I've been able to run a report without scheduling but I'm kind of stuck using it with scheduling. I've build an XML file based on the model generated by the JasperReport Server interface, but I don't know how to use it in my java program. Can somebody help me ?? :) Here is the interesting part of my program : // PUT request - schedule report with an xml job descriptor //Gestion fichier XML contenant la schedulisation InputStream input = new FileInputStream("C:/workspaces/creer_xml/config_rapport.xml"); String value = IOUtils.toString(input, "UTF-8"); List nameValuePairs = new ArrayList(); nameValuePairs.add(new BasicNameValuePair("schedule", value)); System.out.println(nameValuePairs); // contruction de l'url permettant de générer la planification final String resourceUri2 = "/jobs/"; httpRes = restUtils.sendRequest(new HttpPut(), resourceUri2, nameValuePairs, true); And here is the error it returns : INFO [com.jaspersoft.jasperserver.rest.sample.RESTV2Test] generating sample report with parameters and scheduling INFO [com.jaspersoft.jasperserver.rest.sample.RestAPIUtils] sending Request. url: http://localhost:8080/jasperserver/rest_v2/jobs/?schedule=%3C%3Fxml+version%3D%221.0%22+encoding%3D%22UTF-8%22+standalone%3D%22yes%22%3F%3E%0D%0A%3Cjob%3E%0D%0A%09%3Calert%3E%0D%0A%09%09%3Cid%3E0%3C%2Fid%3E%0D%0A%09%09%3CincludingReportJobInfo%3Etrue%3C%2FincludingReportJobInfo%3E%0D%0A%09%09%3CincludingStackTrace%3Etrue%3C%2FincludingStackTrace%3E%0D%0A%09%09%3CjobState%3EFAIL_ONLY%3C%2FjobState%3E%0D%0A%09%09%3Crecipient%3EOWNER_AND_ADMIN%3C%2Frecipient%3E%0D%0A%09%09%3CtoAddresses%2F%3E%0D%0A%09%09%3Cversion%3E-1%3C%2Fversion%3E%0D%0A%09%3C%2Falert%3E%0D%0A%09%3CbaseOutputFilename%3EEssaiRapportListeNokia%3C%2FbaseOutputFilename%3E%0D%0A%09%3CrepositoryDestination%3E%0D%0A%09%09%3CfolderURI%3E%2Freports%2Fsamples%3C%2FfolderURI%3E%0D%0A%09%09%3Cid%3E2%3C%2Fid%3E%0D%0A%09%09%3CoutputDescription%3Eazertyyy%3C%2FoutputDescription%3E%0D%0A%09%09%3CoutputFTPInfo%3E%0D%0A%09%09%09%3CpropertiesMap%2F%3E%0D%0A%09%09%3C%2FoutputFTPInfo%3E%0D%0A%09%09%3CoverwriteFiles%3Efalse%3C%2FoverwriteFiles%3E%0D%0A%09%09%3CsaveToRepository%3Etrue%3C%2FsaveToRepository%3E%0D%0A%09%09%3CsequentialFilenames%3Etrue%3C%2FsequentialFilenames%3E%0D%0A%09%09%3CusingDefaultReportOutputFolderURI%3Efalse%3C%2FusingDefaultReportOutputFolderURI%3E%0D%0A%09%09%3Cversion%3E0%3C%2Fversion%3E%0D%0A%09%3C%2FrepositoryDestination%3E%0D%0A%09%3CcreationDate%3E2013-05-31T10%3A45%3A08%2B02%3A00%3C%2FcreationDate%3E%0D%0A%09%3Cdescription%3Epif+paf+pouf%3C%2Fdescription%3E%0D%0A%09%3Cid%3E%3C%2Fid%3E%0D%0A%09%3Clabel%3Eencoreun%3C%2Flabel%3E%0D%0A%09%3CoutputFormats%3E%0D%0A%09%09%3CoutputFormat%3EPDF%3C%2FoutputFormat%3E%0D%0A%09%3C%2FoutputFormats%3E%0D%0A%09%3CoutputLocale%2F%3E%0D%0A%09%3CoutputTimeZone%3EEurope%2FParis%3C%2FoutputTimeZone%3E%0D%0A%09%3Csource%3E%0D%0A%09%09%3Cparameters%3E%0D%0A%09%09%09%3CparameterValues%3E%0D%0A%09%09%09%09%3Centry%3E%0D%0A%09%09%09%09%09%3Ckey%3EREPORT_TIME_ZONE%3C%2Fkey%3E%0D%0A%09%09%09%09%09%3Cvalue+xsi%3Atype%3D%22xs%3Astring%22%3EEurope%2FParis%3C%2Fvalue%3E%0D%0A%09%09%09%09%3C%2Fentry%3E%0D%0A%09%09%09%3C%2FparameterValues%3E%0D%0A%09%09%3C%2Fparameters%3E%0D%0A%09%09%3CreportUnitURI%3E%2Freports%2Fsamples%2FEssaiRapportListeNokia%3C%2FreportUnitURI%3E%0D%0A%09%3C%2Fsource%3E%0D%0A%09%3CsimpleTrigger%3E%0D%0A%09%09%3Cid%3E2%3C%2Fid%3E%0D%0A%09%09%3CmisfireInstruction%3E0%3C%2FmisfireInstruction%3E%0D%0A%09%09%3CstartDate%3E2013-05-31T21%3A00%3A00%2B02%3A00%3C%2FstartDate%3E%0D%0A%09%09%3CstartType%3E2%3C%2FstartType%3E%0D%0A%09%09%3Ctimezone%3EEurope%2FParis%3C%2Ftimezone%3E%0D%0A%09%09%3Cversion%3E0%3C%2Fversion%3E%0D%0A%09%09%3CoccurrenceCount%3E1%3C%2FoccurrenceCount%3E%0D%0A%09%3C%2FsimpleTrigger%3E%0D%0A%09%3Cusername%3Ejasperadmin%3C%2Fusername%3E%0D%0A%09%3Cversion%3E0%3C%2Fversion%3E%0D%0A%3C%2Fjob%3E INFO [com.jaspersoft.jasperserver.rest.sample.RestAPIUtils] req method: PUT INFO [com.jaspersoft.jasperserver.rest.sample.RestAPIUtils] response status line: HTTP/1.1 302 Temporarely moved Exception in thread "main" java.lang.AssertionError: could not generate report at org.junit.Assert.fail(Assert.java:91) at org.junit.Assert.assertTrue(Assert.java:43) at com.jaspersoft.jasperserver.rest.sample.RESTV2Test.test(RESTV2Test.java:112) at com.jaspersoft.jasperserver.rest.sample.RESTV2Test.main(RESTV2Test.java:47)
  2. Thank you so much ! Everything is working now ! :) I think that the problem was coming from my authentification but it solved now. I hope I don't abuse of you but if anyone have an exemple or a tutorial of a scheduling in java, I'm here ! Thanks again.
  3. Thanks a lot ! That's really nice. I'll continue the other part of my project waiting for your help :) Thanks again
  4. Hey, I'm new in the JasperReport community. I've been using this solution for 3 weeks. I first used iReport to creat my reports and JasperReport Server to run and schedule them but my compagny want to use this solution in their own application. So I tried to developped a solution using java and rest. I can run a report and it works. But we need to use rest_v2 in our application because we need to be able to get the statut of a report (when scheduling) and I can't make it run. It works when I just put the URL in FireFox but when I use a little programm in java to run it, I get a 403 forbidden error even if the programm (almost the same one) works with Rest (v1). Here is an example of my really little programm to run with Rest_v2 a report : public class Get_Rapport { public static void main(String[] args) throws Exception { CredentialsProvider credsProvider = new BasicCredentialsProvider(); credsProvider.setCredentials( new AuthScope("localhost", 8080), new UsernamePasswordCredentials("jasperadmin", "jasperadmin")); CloseableHttpClient httpclient = HttpClients.custom() .setDefaultCredentialsProvider(credsProvider).build(); try { HttpGet httpget = new HttpGet("http://localhost:8080/jasperserver/rest_v2/reports/reports/samples/Essai..."); System.out.println("executing request" + httpget.getRequestLine()); CloseableHttpResponse response = httpclient.execute(httpget); System.out.println(response.getStatusLine()); } finally { httpclient.close(); } It would be really nice to explain me what's wrong, cause I really don't get it :( I'm a student and that's the topic ofmy placement so I have to find a way to do it... Thanks. Jb ------------------------------------------------------------------------------------------------------------------------------------------------------------ Do someone has an example of runing a report with Rest_v2 in Java if you don't know the issue i'm facing ? Thanks :)
  5. Please ... Can you help me ? Do someone has an example of runing a report with Rest_v2 in Java if you don't know the issue i'm facing ? Thanks :)
  6. Hey, I'm new in the JasperReport community. I've been using this solution for 3 weeks. I first used iReport to creat my reports and JasperReport Server to run and schedule them but my compagny want to use this solution in their own application. So I tried to developped a solution using java and rest. I can run a report and it works. But we need to use rest_v2 in our application because we need to be able to get the statut of a report (when scheduling) and I can't make it run. It works when I just put the URL in FireFox but when I use a little programm in java to run it, I get a 403 forbidden error even if the programm (almost the same one) works with Rest (v1). Here is an example of my really little programm to run with Rest_v2 a report : public class Get_Rapport { public static void main(String[] args) throws Exception { CredentialsProvider credsProvider = new BasicCredentialsProvider(); credsProvider.setCredentials( new AuthScope("localhost", 8080), new UsernamePasswordCredentials("jasperadmin", "jasperadmin")); CloseableHttpClient httpclient = HttpClients.custom() .setDefaultCredentialsProvider(credsProvider).build(); try { HttpGet httpget = new HttpGet("http://localhost:8080/jasperserver/rest_v2/reports/reports/samples/EssaiRapportListeNokia.pdf?DiffAge=17"); System.out.println("executing request" + httpget.getRequestLine()); CloseableHttpResponse response = httpclient.execute(httpget); System.out.println(response.getStatusLine()); } finally { httpclient.close(); } It would be really nice to explain me what's wrong, cause I really don't get it :( I'm a student and that's the topic ofmy placement so I have to find a way to do it... Thanks. Jb
×
×
  • Create New...