Jaspert报告从具有Web服务的提供商那里获取数据.如何? [英] Jaspert report get data from provider with web service. How to?

查看:38
本文介绍了Jaspert报告从具有Web服务的提供商那里获取数据.如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个系统,该系统具有数据,并且可以通过Web服务(例如Lotus Notes数据库)提供其数据. Jasper可以通过调用网络服务来获取报告数据吗?

There is system, that has data, and can provide it's data with web-services (for example Lotus Notes database). Can Jasper get data for it's report by calling web-service?

推荐答案

可以,但是很快就会变得非常复杂.但是,如果您想走这条路,使用

You can, but it will probably get very complicated very quickly. But if you want to travel that path, it is definitely possible with a JRXmlDataSource. You will have to define the datasource like:

new net.sf.jasperreports.engine.data.JRXmlDataSource(
net.sf.jasperreports.engine.util.JRLoader.getLocationInputStream("http://yourserver.com/xml_data_source")

请参见帖子,似乎有人已经开始执行类似的任务,以便从远程服务器检索xml数据以获取报告.

See this post, where someone seems to have embarked on a similar quest, to retrieve xml data from a remote server for the report.

话虽如此,如果您从代码中的服务器中获取数据,选择要用于报告的字段并将其传递给您,代码的工作量可能会减少很多,代码的可维护性也将大大提高.例如,作为JRMapCollection数据源,尤其是在远程服务提供wsdl的情况下,您可以使用诸如Apache Axis之类的工具针对该wsdl生成客户端.

That being said, it will probably be a lot less work, and your code will probably be a lot more maintainable if you fetch the data from the server in your code, select the fields you want for your report and pass it in as, say, a JRMapCollection datasource, especially if the remote service offers a wsdl against which you could generate a client using a tool like Apache Axis.

这篇关于Jaspert报告从具有Web服务的提供商那里获取数据.如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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