Jump to content

How to pass query parameters to a remote XML data source


Recommended Posts


I am new to jaspersoft.  I am looking for a tutorial and/or explaination on how to specify query parameters for a remote XML data source.

We have a RESTful api that returns XML records and I would like to have the user of a report that pulls from the remote XML data source (our api) be able to specify a set of query parameters.

E.g. the call to the API might look like this: https://api.mydomain.com/api/records

and the query parameters might specify a userId and time range for records where the resulting GET request to the api would be:

Eg. https://api.mydomain.com/api/records/1234/?startTime=2013-09-01T00:00:00.000Z&endTime=2013-10-12T00:00:00.000Z

I am developing the report in iReport Designer Pro version 5.2.0 and deploying to jasperserver-pro in AWS.

Any insight is appreciated.  Thanks.


Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

For this you will need to use the xPath2 query executor. This http://community.jaspersoft.com/wiki/remote-xml-datasource is a really godd example of the use of remote XML datasources in Jasper

The full sample does reporting based on the Twitter open API has parameters that are passed to the API call to select the twitter account and the amount of tweets you want to retrieve, similar to your needs.

A couple of considerations: this sample it was made for JRS 4.7 but works with 5.2 and AWS without issues. The only problem is that since then Twitter has deprecated the 1.0 version of their API and they no longer provide XML data in their API so you will not be able to run the report as is. But it will be easy enough to change it to use your own API.



Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...