-1

I have developed a template design in JasperSoft Studio. I can upload the template code, if necessary. The template that I created using a connection to PostgreSQL database via JDBC for filling the report. Then I picked up the local JasperReports Server and download the template on the server. In this regard, I have a few questions.

  1. Can I use as the data json or xml (instead JDBC)?
  2. How I can pass the data (json or xml) to a template stored on the server, using Web Services?
  3. Could not you make a simple example in python?
Sergey Sigaev
  • 100
  • 2
  • 10
  • Regarding your first question: Have you seen this post? http://stackoverflow.com/questions/11536995/create-jasper-report-pdf-form-from-json-object-or-json-string – tobi6 May 19 '16 at 11:34
  • Thank you very much for your answer. I did not see this topic. After reading, I realized that it is possible to use as a data `JSON`, but your link I do not understand how the report filling. Is it possible to do without the use of a Data Adapter? – Sergey Sigaev May 20 '16 at 11:40

1 Answers1

0
  1. Yes, you need to use a JSON or XML Data Adapter. You can create a Data Adapter in Jaspersoft Studio and then deploy it in JasperReports Server. Although not stated in that tutorial, you also need to upload the JSON or XML file with the actual data, file that is referenced in the Data Adapter.

A good example of how your files should look like is the Table Report report on the /reports/interactive path of the repository. If you inspect the report with Jaspersoft Studio' Repository Explorer you will see that the report uses the CSV Data Adapter from the same folder. If you open that adapter file you will see that it uses the CSV Data file from the same folder.

  1. JasperReports Server provides RESTful services with which you interact with the Server resources(reportUnits, inputControls, file resources, etc.). With these services, you do not alter the design of the report template. Once you have figured out, from point #1, what you need to have in your template and you have created your adapter file(an XML file), you can use the Repository service to upload your files.

  2. I think there are plenty of resources out there describing how to make requests to RESTful services in python. This one could be a start: Making a request to a RESTful API using python

Community
  • 1
  • 1
Narcis
  • 2,421
  • 4
  • 16
  • 23
  • thank you very much for your answer. The report template `jrxml` and the `Data Adapter` must be stored on the server? I would like to **dynamically** send their to server (rather than storing them on a server), and as a response to receiving the report in various formats. Is that possible? Correct me if I'm wrong. – Sergey Sigaev May 20 '16 at 11:32
  • The template and the adapter must be on the server in order to run the report. There is no other way. Although answer #1 also shows how to manually do things, it is more about how to prepare the files that you are going to be uploading using answer #2. With the files on the server, you can then use the Reports Service(http://community.jaspersoft.com/documentation/tibco-jasperreports-server-rest-api-reference/v621/reports-service) to execute the report and get the output in whatever format is supported(pdf, html, xls, docx, etc) – Narcis May 20 '16 at 13:27
  • I've edited my answer and added some clarifications and pointed to an example within the JasperReports Server that already uses this approach. In the end, with the REST services you will just be manipulating these resources(upload/update/delete the report, the data adapter or the data file) – Narcis May 20 '16 at 14:25
  • Thank you for helping me to understand the issue. Summing up, the algorithm when creating a report is as follows: At first, create a design report `.jrxml` in Jaspersoft Studio, which contains the fields of the report, the pictures and its overall structure. Secondly, сreate a Data Adapter to fill in the report template you created in step 1. The final step is download the template and the Data Adapter on the server. – Sergey Sigaev May 20 '16 at 15:55
  • P.S. The reports Service is deprecated in last release. The reportExecutions Service is advised to use. Last question: Do I understand correctly that I have to write content of the request to to the server in a text editor? Like [here](http://community.jaspersoft.com/documentation/tibco-jasperreports-server-rest-api-reference/v621/reportexecutions-service#Running_a_Report_Asynchronously) `reportExecutionRequest`. Are there any automated tools for this, so as not to prescribe codes of all the tags manually? – Sergey Sigaev May 20 '16 at 16:11