Obtenha relatório do jasperserver usando o serviço web REST e asp.net C #

Você pode usar os serviços da web jasperservers (SOAP e REST estão disponíveis) para gerenciar e executar relatórios em um aplicativo da web. O wsdl SOAP não é compatível com o asp.net c # (pelo menos, não consigo fazê-lo funcionar), por isso decidi usar o serviço web REST.

Estou quase lá, mas não consigo recuperar o relatório em si. alguém sabe o que está errado? Estou usando o jasperserver CE 4.5 no Linux.

// Setup WebClient 
WebClient httpclient = new WebClient();

//Basic Auth
httpclient.Credentials = new NetworkCredential("NAME", "PASSWD");
httpclient.Headers.Add("Content-Type", "application/x-www-form-urlencoded");

// Build resourceDescriptor
string requestXml;
requestXml =  "<resourceDescriptor name="budget_overzicht_per_klant" wsType="reportUnit" uriString="/Declaraties/12change/Klant/budget_overzicht_per_klant"n";
requestXml += " isNew="false">n";
requestXml += "   <label>null</label>n";
requestXml += "   <parameter name="klantid">14</parameter>n";
requestXml += "   <parameter name="start">20120101</parameter>n";
requestXml += "   <parameter name="eind">20120302'</parameter>n";
requestXml += "   <parameter name="Titel">Test 123</parameter>n";
requestXml += "</resourceDescriptor>n";

// Send PUT
string requestAllResult = httpclient.UploadString("http://website/jasperserver/rest/report/Declaraties/12change/Klant/budget_overzicht_per_klant?RUN_OUTPUT_FORMAT=PDF", "PUT", requestXml);

// requestAllResult contains:
//<report>
//  <uuid>f521fe7d-7432-4c47-962c-9fec29bdaa43</uuid>
//  <originalUri>/Declaraties/12change/Klant/budget_overzicht_per_klant</originalUri>
//  <totalPages>4</totalPages>
//  <startPage>1</startPage>
//  <endPage>4</endPage>
//  <file type="application/pdf"><![CDATA[report]]></file>
//</report>
// You have to use the uuid to GET the file 'report'
//
// Extract uuid, filename is always report
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.LoadXml(requestAllResult);
XmlNode node = doc.DocumentElement.SelectSingleNode("uuid");
string uuid = node.InnerText;

//Build GET URL
string reportUrl = "http://website/jasperserver/rest/report/";
reportUrl += uuid;
reportUrl += "?file=report";

// the value of report Url is now 
// "http://website/jasperserver/rest/report/f521fe7d-7432-4c47-962c-9fec29bdaa43?file=report"

// Get report
string report;
report = httpclient.DownloadString(reportUrl);

// Exception, HTTP 404 ERROR????

O erro parece significar que o uuid não está na sessão atual. Alguém fez isso funcionar? Obrigado

questionAnswers(4)

yourAnswerToTheQuestion