使用REST API生成JasperServer报告时传入内容 [英] Passing in content when generating JasperServer report using the REST API

查看:312
本文介绍了使用REST API生成JasperServer报告时传入内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个旨在用JasperReports Server替换当前PDF生成器的项目。计划是使用REST / HTTP API来实现系统之间的高级抽象。

I'm working on a project that aims to replace our current PDF generator with JasperReports Server. The plan is to use the REST/HTTP API to reach a high level of abstraction between the systems.

最理想的是,我们不希望JasperReports Server从中提取数据数据库,因为这会绕过调用应用程序体系结构中的现有日志记录和授权。相反,我们首先要在调用应用程序中提取内容,然后将该内容传递给JasperReports Server。

Optimally, we do not want to let JasperReports Server pull the data from the database, since this would bypass the existing logging and authorization in the calling application's architecture. Instead, we'd like to start with extracting the content in the calling application, and then pass that content to JasperReports Server.

我们已经做了相当多的调查,缺乏相关结果表明这不是您通常使用JasperReports Server的方式。我们发现的教程中的输入参数通常是标量值(整数,布尔值或字符串),而不是复杂的结构或对象。此外,似乎每个样本或多或少都假设您希望让JasperReports Server连接到数据库。

We've done quite a bit of investigating, and the lack of relevant results indicates that this is not how you typically use JasperReports Server. The input parameters in the tutorials we've found are typically scalar values (integers, booleans or strings), and not complex structures or objects. Furthermore, it seems like more or less every sample assumes that you want to let JasperReports Server connect to a database.

如果可以传入复杂的结构(如数组)地图,其中一些地图元素是数组或地图本身),这样做的最佳做法是什么?我不知道如何在请求体中格式化这样的结构。 SOAP API更适合吗?

If it's possible to pass in complex structures (like an array of maps, where some map elements are arrays or maps themselves), what's the best practice for doing this? I have no idea of how such a structure should be formatted in the request body. Is the SOAP API a better fit?

如果根本不设计JasperReports Server解决方案,那么哪种替代产品/解决方案更合适?

If this is not at all how you should design a JasperReports Server solution, what alternative products/solutions are more suitable?

提前感谢任何输入。

推荐答案

花了几个小时研究,我想我已经准备好回答我自己的问题了。

After several hours spent on research, I think I'm ready to answer my own question.

JasperReports Server(下面的JRS)基本上是为了自己获取数据而设计的。虽然可以强制向JRS提供数据,但我决定不这样做。

JasperReports Server ("JRS" below) is fundamentally designed to fetch data by itself. Although it would be possible to force feed JRS with data, I've decided not to.

不让JRS获取数据的一个最明显的缺点是将无法再从JRS Web界面生成报告。如果客户端应用程序负责以预定义的格式提供数据,那么与其他系统的集成也变得不可能或困难。

One of the most obvious drawback of not letting JRS fetch the data itself is that it would no longer be possible to generate reports from the JRS web interface. Integration from other systems also becomes impossible or difficult if the client application is responsible for supplying the data in a predefined format.

在我正在开发的项目中,我们'我们决定构建一个基于Remote XML DataSource的自定义JRS DataSource,它调用客户端应用程序的XML API。换句话说,客户端应用程序从JRS请求报告,然后JRS从客户端应用程序请求它的数据。我们必须扩展XML API以满足我们的所有报告需求,但在我看来这是一件好事。良好的API覆盖范围将在未来派上用场。

In the project I'm working on, we've decided to build a custom JRS DataSource based on the Remote XML DataSource, that invokes the client application's XML API. In other words, the client application requests a report from JRS, and JRS then requests it's data from the client application. The XML API will have to be expanded to cover all of our reporting needs, but that's a good thing in my opinion. Good API coverage will come in handy in the future.

我希望这些想法可以帮助有类似问题的人。

I hope these thoughts helps someone having similar questions.

这篇关于使用REST API生成JasperServer报告时传入内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆