The Jasper Report gets data from the provider with the web service. How?

advertisements

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")

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

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.