I have created jrxml report by iReport. Then I have run it with JasperServer and it work perfectly. I have generate pdf report by this URL:
http://localhost:8081/jasperserver/flow.html/flowFile/my_report.pdf
It works well but when I tried to refresh the page I get this error:
An id is required to lookup a FlowDefinition
Also when I try to call this REST service in JasperServer client application I get this error:
com.sun.jersey.api.client.UniformInterfaceException: Client response status: 500
This is the Java client application to call the REST service:
public final static String serverUrl = "http://localhost:8081/jasperserver/flow.html/flowFile/my_report.xls";
public final static String serverUser = "jasperadmin";
public final static String serverPassword = "jasperadmin";
static File outPutDir= new File(System.getProperty("java.io.tmpdir"));
public static void main(String[] args) {
try {
Report report = new Report();
report.setUrl("/reports/samples/Employees");
report.setOutputFolder(outPutDir.getAbsolutePath());
JasperserverRestClient client = JasperserverRestClient.getInstance(serverUrl, serverUser, serverPassword);
File reportFile = client.getReportAsFile(report);
} catch (Exception e) {
e.printStackTrace();
}
}
flowId
When calling flow.html
you must provide an action, which is put into the flowId
. JasperServer is using the flow.html
to provide an interface which can be accessed over the URL. For example if calling a report this would be:
_flowId=viewReportFlow
Also the report and parameters have to be provided. So with this in mind the URL could look like this:
http://localhost:8081/jasperserver/flow.html?_flowId=viewReportFlow&reportUnit=/reports/samples/Employees&j_username=the_user&j_password=secret&output=pdf
Server error
When connecting to the server, this URL is used
http://localhost:8081/jasperserver/flow.html/flowFile/my_report.xls
This is not the server URL used by JasperserverRestClient
. The server URL should look like this:
http://localhost:8081/jasperserver
NOTE: flow.html
is for accessing JasperServer without logging into the UI. It is not an application path where you should put your reports.