How to pass query parameters to a remote XML data source

1

Hello,

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...

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.

 

lpalum's picture
7
Joined: Oct 2 2013 - 10:44am
Last seen: 3 years 9 months ago

2 Answers:

1

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.

Best,

Mariano

marianol's picture
4427
Joined: Sep 13 2011 - 8:04am
Last seen: 9 months 2 weeks ago
0

Hi,

a similar thread you'll find here.

Marius

mariuss's picture
94
Joined: Aug 11 2013 - 2:33pm
Last seen: 5 years 6 months ago
Feedback