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.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+vers...
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)