Judes Posted July 19, 2021 Share Posted July 19, 2021 Hi,Recently we have migrated the japser sever 5.2 to 7.8.Now we are changing the rest api call rest to rest_v2 and have changed the login and get report resource rest call based on the rest_v2.ClientConfig config = new ClientConfig();BasicAuthSecurityHandler basic = new BasicAuthSecurityHandler();basic.setUserName(jasperadmin);basic.setPassword(jasperadmin);config.handlers(basic);config.acceptHeaderAutoSet(true);1. Rest Api : Login to Jasper ServerResource resource = client.resource("http://localhost:8080/jasperserver"+ "/rest_v2/login"); response = resource.contentType("application/x-www-form-urlencoded").accept("text/plain").post(loginStr);2. Get report resource for the given report nameresource = client.resource("http://localhost:8080/jasperserver" + "/rest_v2/resources/reports/" + "PM/test");resource.header("Cookie", cookieString).header("Access-Control-Allow-Origin", "*"); resource.accept("application/xml");response = resource.contentType("text/plain").get();3.Execute the reportresource =client.resource("http://localhost:8080/jasperserver"+ "/rest/reports/reports/" + reportName + "?RUN_OUTPUT_FORMAT=" + format);resource.header("Cookie", cookieString);resource.accept("application/xml");response = resource.contentType("text/xml").put(xmlToString(doc));doc = parseXMLMessage(response.getEntity(String.class));NodeList nList = doc.getDocumentElement().getElementsByTagName("uuid");4. Retrieve the report contentString uuid = nList.item(0).getTextContent();resource = client.resource("http://localhost:8080" + "/rest/report/" + uuid + "?file=report");resource.header("Cookie", cookieString);response = resource.get();we can able to run Step 1 and Step 2 successfully but step 3 while runing got 405 error.Step 3 - How to call the rest api and how to put the XML content to jasper server.Kindly assist me provide solution for how to implement the step 3 and step 4 using rest_v2 rest api call . Regards,Judes 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