kessleag Posted October 16, 2014 Share Posted October 16, 2014 I'm new to Jasperserver but through multiple iterations I've been able to come up with this: //CODEvar request = require("request"), qs = require('querystring'), url = 'localhost:8080/jasperserver/rest/resource/reports/test/UserReports', baseRequest = request.defaults({ jar: true });baseRequest.post({ url: "http://localhost:8080/jasperserver/rest/login?j_username=jasperadmin&j_password=jasperadmin"}, function (e, r, body) { baseRequest.get({ url: 'http://localhost:8080/jasperserver/rest/resource/reports/test/UserReports' }, function (e, r, body) { baseRequest.put({ url: 'http://localhost:8080/jasperserver/rest/report/reports/test/UserReports', body: '<resourceDescriptor></resourceDescriptor> ' }, function (e, r, body) { baseRequest.get({ url: 'http://localhost:8080/jasperserver/rest/report/58f342c1-a3a0-4df2-8855-6596deec9883?file=report' }, function (e, r, body) { console.log®; }); //console.log®; }); });}); //CODE Basically I have my report on Jasper Server and I'm trying to retrieve as a pdf through a Javascript file using node. Everything returns okay and fine except for my GET request at the end. It always returns a "report not found (uuid not found in session)" error, and I am unsure of how to get a uuid that stays constant. Note: The <resourceDescriptor> is there because the actual resourceDescriptor was simply too long and had very janky formatting. Link to comment Share on other sites More sharing options...
ernestoo Posted October 20, 2014 Share Posted October 20, 2014 Just reading the doc for request - seems that cookies are disabled by default, would jar:true solve the problem? (from https://github.com/mikeal/request) Link to comment Share on other sites More sharing options...
kessleag Posted October 22, 2014 Author Share Posted October 22, 2014 Okay so creating a new variable called baseRequest and using that in all my statements worked up until the last GET statement, so the "full authentication" error was being caused by cookies being disabled by default. Link to comment Share on other sites More sharing options...
kessleag Posted October 22, 2014 Author Share Posted October 22, 2014 I did in fact find a solution: It was to use iframe to call the Jasperserver url, this allows me to access all my reports and junk through an external html file. Although I still wish to make this code work because it's been a good learning experience and I want to see this through to the end. 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