Jasperreport with restful webservice as datasource


Hi Experts,

I am newbie to jaspersoft. I have a requirement to create report using RESTful webservice as a datasource. The provided RESTful webservice can accept parameters for filters either through GET/POST/PUT/DELETE methods and respond in XML/JSON format. I am unable to find a way to pass the user inputs as parameter to RESTful webservice.

Using s/w version- jaspersoft studio 6.1.0, jasperreprt server 6.1.0

Any leads is appreciated. Thanks in advance.


mihir_3's picture
Joined: Sep 1 2015 - 8:10pm
Last seen: 4 years 1 month ago

@asimkin- Thanks for quick response. Yes, by given suggestion we can FILTER data in jasperserver.
However, we want to send this $P{p_org} to the RESTful webservice(3rd party) so that service can return only filtered data.

mihir_3 - 4 years 1 month ago

@hozawa- Thanks for response. I think you got me wrong here. We want to populate data from 3rd party RESTful web service in Jasperserver and we want to send parameter e.g. http://xxxx:8080/getdata?parameterName=$P{p_org}, $P{p_org} is user input variable.

mihir_3 - 4 years 1 month ago
I have the same requirement but have found no way to do it. I tried several methods that use xpath2 and a parameter named XML_URL, but JapersoftStudio does not supportxpath2 anymore. I also tried a suggest where you create a parameter named net.sf.jasperreports.data.adapter and pass that in, but that didn't work either. If you find a solution, let me know and I will do likewise. Dan
dan_17 - 4 years 1 month ago

5 Answers:



I used JasperReports Server REST_v2 web-service to test your scenario and to pass required organization name as a parameter.

So, what I did:

  1. In Jaspersoft Studio create new data adapter using 'XML document' type and specify JasperReports Server REST organizations service URL for File field
    and select 'Use the report Xpath expression when filling the report' option: 

  2. Create a new report using the new dataadapter with Xpath expression:


    Run the report to verify how it works. It should return all existing organizations in JasperReports Server
  3. Create a new parameter with java.lang.String type, for example p_org, and then modify Xpath expression to

  4. Run the report, enter organization_1 as the parameter value. The report returns 1 record for organization_1

Here you can find a short summary how to use Xpath expression to filter data:


Hope this help you to implement your task

asimkin's picture
Joined: Jun 16 2014 - 6:30am
Last seen: 17 hours 4 min ago

Not sure what the problem is but can't you just add ?parameterName=value to the url?






hozawa's picture
Joined: Apr 24 2010 - 4:31pm
Last seen: 4 months 1 week ago

Somehow we are able to do. we have tried a method that use xpath2 and a parameter named XML_URL. Since Latest jasper doesn't support xpath2 so we need to tweak two things

  1. Drop jasperreports-extensions-3.5.3.jar file to "..\XXXXXXXXXX\jasperserver\WEB-INF\lib"
  2. Browse to "..\XXXXXXXX\jasperserver\WEB-INF\classes\jasperreports.properties"
  • Add the following line of code to properties file
  • net.sf.jasperreports.query.executer.factory.xpath2 = com.jaspersoft.jrx.query.JRXPathQueryExecuterFactory

Restart tomcat

After above configuration xpath2 functionality can be achived and it resolved our issue.



mihir_3's picture
Joined: Sep 1 2015 - 8:10pm
Last seen: 4 years 1 month ago

Despite these instructions, I am unable to get it to work. JasperStudio will not recognize xpath2 as the query language so it fails when I try to uplod the report to the server. Guess I will need to find another solution

dan_17's picture
Joined: Jun 16 2015 - 12:35pm
Last seen: 3 years 4 weeks ago

I too had the error Invalid .jrxml when my properties file was not updated. ***After update make sure to restart the tomcat.

  • net.sf.jasperreports.query.executer.factory.xpath2 = com.jaspersoft.jrx.query.JRXPathQueryExecuterFactory

hope this helps.

mihir_3's picture
Joined: Sep 1 2015 - 8:10pm
Last seen: 4 years 1 month ago