Jasper report download file
Posted on March 10, 2016 at 2:42am
Hi i have jaspersoft server 6 and i have succssfully been able to use the jasperserver/flow.html?_flowId=viewReportFlow url and view a report
Please if you could assist with the following:
1)Can i put a parameter to the jasperserver/flow.html?_flowId=viewReportFlow url and force the server to give only the file and not the rest of the ui (so the browser pops a save as). My intention is to get the final file only so i can somehow change it to base 64 string and save it in the database autocatically
2)If 1 cant be done then i should use web services?
3)I tried the web services through c# but i cant get it to work, My code:
WebClient httpclient = new WebClient();
httpclient.Credentials = new NetworkCredential(username, password);
httpclient.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
string requestXml;
requestXml = "<resourceDescriptor name=\"net.sf.jasperreports.json.source\" wsType=\"inputControl\" isNew=\"false\" uriString=\"/Reports/MyReportFolder/MyReport/net.sf.jasperreports.json.source\">";
requestXml += " <value>"+filepath+"</value>";
requestXml += "</resourceDescriptor>";
string requestAllResult = httpclient.UploadString(serverurl, "PUT", requestXml);
the report works by supplying the filepath of a json file to an inputcontrol which is hidden
i always get a bad request exception in the last line
It says that the ...of type com.jaspersoft.jasperserver.api.metadata.common.domain.InputControlsContainer not found
thanks
Joined: Mar 10 2016 - 1:50am
Last seen: 7 years 2 months ago
Posted on March 10, 2016 at 6:40am
Using web services is the right approach. Take a look at the REST v2 services (documented in the JasperReports Server Web Services Guide), they are easier to use than the SOAP or REST v1 services.
Regards,
Lucian
Joined: Jul 17 2006 - 1:10am
Last seen: 4 days 23 hours ago
Posted on March 10, 2016 at 1:02pm
Joined: Apr 24 2010 - 4:31pm
Last seen: 3 years 12 months ago