Jasper Report calling in ASP.Net displays 405 Method Not Allowed error

Jaspersoft Community 'Read-Only' as of July 8, 2022

Transition to New TIBCO Community Just Weeks Away

You can still search, review wiki content, and review discussions in read-only mode. Please email community@tibco.com with questions or issues requiring TIBCO review or response.

Hi,

I want to call the jasper report in ASP.NET web application.
So I done the following implementation

1. Created Test Report (TestReport.jrxml file) in Jasper Report Studio. Currently report has no parameter.
2. Added report in Jasper Report Server.


3. Tested above report in Jasper Report Server. It loads the data properly.
4. Now, I want to call that report in Asp.net, so added following code

public void DownloadReport()
{
            WebClient httpclient = new WebClient();

            //Authentication credentials
            httpclient.Credentials = new NetworkCredential("jasperadmin", "jasperadmin");

            httpclient.Headers.Add("Content-Type", "application/x-www-form-urlecoded");

            string requestXml;

            /*Report without parameter*/
            requestXml = "<resourceDescriptor name=\"TestReport\" wsType=\"reportUnit\" uriString= \"/jasperserver/rest/reports/TestReport\"";
            requestXml += " isNew=\"false\">";
            requestXml += "</resourceDescriptor>";

            string uploadReport = "http://localhost:8080/jasperserver/rest/reports/TestReport?RUN_OUTPUT_FORMAT=PDF";

            //Sent PUT
            string requestAllResult = httpclient.UploadString(uploadReport, "PUT", requestXml);

            //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://localhost:8080/jasperserver/rest/reports/";
            reportURL += uuid;
            reportURL += "?file=report";

            //Get Report
            string report;
            //Get Session Cookie
            string session = httpclient.ResponseHeaders.Get("Set-Cookie");
            //Set Session Cookie
            httpclient.Headers.Add("Cookie", session);

            //Get Report
            report = httpclient.DownloadString(reportURL);
}

But after running code, 405 Method not allowed error is occurred at following line.
string requestAllResult = httpclient.UploadString(uploadReport, "PUT", requestXml);

Please refer below error message

 

I also refer following link, but nothing is working for me.
https://community.jaspersoft.com/questions/824432/using-rest-service-aspnet

I am new to Jasper Report. So may be I am doing something wrong here.
Please assist.

Thanks

ashn's picture
2
Joined: Jan 10 2020 - 9:44pm
Last seen: 2 years 5 months ago

Is there any solution for this ?

ajju123 - 1 year 10 months ago

0 Answers:

No answers yet
Feedback