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.
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:
- 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:
- 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
- Create a new parameter with java.lang.String type, for example p_org, and then modify Xpath expression to
- 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
Not sure what the problem is but can't you just add ?parameterName=value to the url?
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
- Drop jasperreports-extensions-3.5.3.jar file to "..\XXXXXXXXXX\jasperserver\WEB-INF\lib"
- 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
After above configuration xpath2 functionality can be achived and it resolved our issue.