aliounedia Posted December 14, 2011 Share Posted December 14, 2011 Hi,I have an error (Invalid resource descriptor) when I try to run a report with a put. I have followed the jasperReports server web service documentation. Do you know how can we define resource descriptor?Thnks a lot Link to comment Share on other sites More sharing options...
sanzah Posted February 8, 2012 Share Posted February 8, 2012 Hi Adia,Hi have exactly the same problem. I run the put request in a REST extension in chrome and I have the same problem Request: PUT http://192.168.1.15:8080/jasperserver/rest/report/reports/test Response: Status code:400Date: Wed, 08 Feb 2012 23:16:17 GMT Connection: closeContent-Length: 27 Server: Apache-Coyote/1.1 Cache-Control: private Expires: Thu, 01 Jan 1970 01:00:00 CET Invalid resource descriptor I am able to run other requests normally. Am I missing something? Thank you! Sergio Link to comment Share on other sites More sharing options...
sanzah Posted February 10, 2012 Share Posted February 10, 2012 I'll answer to myself,I managed to run the report. I'll explain what I did. My report is called test.I found valuable information here:http://jasperforge.org/plugins/espforum/view.php?group_id=112&forumid=102&topicid=95212 1. You must be previoulsy logged (there is a POST request for logging, see the manual) if not you must do basic authorization in each GET, PUT, POST request. 2. Run a GET request for getting the reportUnit source descriptor in XML GET http://192.168.1.15:8080/jasperserver/rest/resource/reports/test when this is done, the response is an XML file with the source descriptor for the report "test" (in this case). 3. Run a PUT request for generating the report PUT http://192.168.1.15:8080/jasperserver/rest/report Here there is the keypoint that was causing the error: You have to copy the xml text (ENTIRELY) of the previous GET response into the body of the request Optionally, you can add any parameter value by adding anywhere inside the wsType="reportUnit" environment <parameter name="NAME">VALUE</parameter> This is an example (only first lines) of a resource descriptor for tet report where the parameter "a" has been set to 2. <resourceDescriptor name="test" wsType="reportUnit" uriString="/reports/test" isNew="false"> <label><![CDATA[test]]></label> <parameter name="a">2</parameter>... The response contains the report UUID <report> <uuid>0d6e3dc7-006c-4f61-b056-b33688c65964</uuid> <originalUri>/reports/test</originalUri> <totalPages>1</totalPages> <startPage>1</startPage> <endPage>1</endPage> <file type="application/pdf"><![CDATA[report]]></file></report> 4. Finally you have to run a get request to load the resulting report file. You hace to use the UUID provided in previous step GET http://192.168.1.15:8080/jasperserver/rest/report/0d6e3dc7-006c-4f61-b056-b33688c65964?file=report This can be done from any webbrowser, the report in pdf should load. Hope it helps!!Cheers!Sergio Link to comment Share on other sites More sharing options...
cpuguy83 Posted February 17, 2012 Share Posted February 17, 2012 I am not sure I understand how to format the request body. I am a bit of newb with this stuff and am working with creating a custom REST client in my Rails app.I am able to get the resource for the report, but what exactly am I doing in the HTTP request to the report service with it? Is it a field value that gets set in the put request? Link to comment Share on other sites More sharing options...
norcenmarco Posted September 3, 2012 Share Posted September 3, 2012 Hi!I'm facing the same problem.... I don't understand how to modify the body of the request.Any suggestion? CheersMarco Norcen Link to comment Share on other sites More sharing options...
sanzah Posted September 3, 2012 Share Posted September 3, 2012 Hi Marco and cpuguy83,I'm not an expert but I guess that you need to send HTTP comands through the net and manipulate responses. It depends on the language you use. For example, I'm using PHP, and I use curl for constructing and sending http commands (get and put).http://es.php.net/manual/en/book.curl.phpSimilar libraries should exist in other languages as Java.So, what you need is to construct your GET command, send it and store the response. Then you have to include that response directly in the body of the PUT command,Take a look to this thread. It also includes some wokring code in PHP.http://jasperforge.org/plugins/espforum/view.php?group_id=112&forumid=102&topicid=94269If you do not modify the file descriptor, Jasperserver will create a report with default parameters (if any in the report). If you want to specify some values for the report you must modify the xml file descriptor using some XML manipulator library. For example in PHP take a look at:http://developer.yahoo.com/php/howto-parseRestPhp.htmlI don't know for other languages but the pilosophy should be similar.Cheers!Sergio Link to comment Share on other sites More sharing options...
norcenmarco Posted September 5, 2012 Share Posted September 5, 2012 Thanks for answer Sergio.i found a solution, i think i was looking the wrong docs.PutMethod put = new PutMethod(request3);put.setRequestEntity(new StringRequestEntity(descriptor, "text/xml", "UTF-8"));int statusCode3 = client.executeMethod(put); Here how i modify my body request!! Cheers! Link to comment Share on other sites More sharing options...
ganesh.simhadri Posted July 4, 2013 Share Posted July 4, 2013 I got the resource descriptor using the second step http://localhost:8080/jasperserver/rest/resource/reports/samples/AllAccounts now what i have to do to show this report on web application. I didn't understand your third step clearly Link to comment Share on other sites More sharing options...
assiacpge2011 Posted May 13, 2015 Share Posted May 13, 2015 First of all I want to thank Sergio for his help, I followed the steps and that worked perfectly to export an HTML report. But when I tried to export a PDF one, the PDF downloaded is Blank. But the number of pages in that PFD file is the same as when I export the report in Ireport or Jasperserver.Do you have an idea how to get the PDF report generated?thanks,Assia 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