mihir_3 Posted September 2, 2015 Share Posted September 2, 2015 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.0Any leads is appreciated. Thanks in advance.-Mihir Link to comment Share on other sites More sharing options...
asimkin Posted September 2, 2015 Share Posted September 2, 2015 Hi,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 fieldand select 'Use the report Xpath expression when filling the report' option: http://localhost:8090/jasperserver-pro/rest_v2/organizations?j_username=superuser&j_password=superuser Create a new report using the new dataadapter with Xpath expression:/organizations/organizationRun 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/organizations/organization[id=$P{p_org}] 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:http://www.w3schools.com/xml/xml_xpath.aspHope this help you to implement your task Link to comment Share on other sites More sharing options...
hozawa Posted September 2, 2015 Share Posted September 2, 2015 Not sure what the problem is but can't you just add ?parameterName=value to the url?e.g.http://<host>:<port>/jasperserver[-pro]/rest_v2/reports/reports/samples/EmployeeAccounts.html?EmployeeID=sarah_id Reference:http://community.jaspersoft.com/documentation/tibco-jasperreports-server-web-services-guide/v610/running-report-1 Link to comment Share on other sites More sharing options...
mihir_3 Posted September 2, 2015 Author Share Posted September 2, 2015 @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. Link to comment Share on other sites More sharing options...
mihir_3 Posted September 2, 2015 Author Share Posted September 2, 2015 @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. Link to comment Share on other sites More sharing options...
dan_17 Posted September 2, 2015 Share Posted September 2, 2015 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 Link to comment Share on other sites More sharing options...
mihir_3 Posted September 10, 2015 Author Share Posted September 10, 2015 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 thingsDrop jasperreports-extensions-3.5.3.jar file to "..XXXXXXXXXXjasperserverWEB-INFlib"Browse to "..XXXXXXXXjasperserverWEB-INFclassesjasperreports.properties"Add the following line of code to properties filenet.sf.jasperreports.query.executer.factory.xpath2 = com.jaspersoft.jrx.query.JRXPathQueryExecuterFactoryRestart tomcatAfter above configuration xpath2 functionality can be achived and it resolved our issue.Cheers Link to comment Share on other sites More sharing options...
dan_17 Posted September 10, 2015 Share Posted September 10, 2015 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 Link to comment Share on other sites More sharing options...
mihir_3 Posted September 15, 2015 Author Share Posted September 15, 2015 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.JRXPathQueryExecuterFactoryhope this helps. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now