rsuddhala Posted June 26, 2015 Share Posted June 26, 2015 Hi All,I have written following code to update reports in webservices.The update is not working but responseCode is getting correct.I also checked status I got state as finished.But when i delete the report from the jasper server and run the below code then i can see the new report is uploaded.I mean when deleting report it works fine but it is not working fine when report alredy exits in jasper server .Is there any changes need to be done for updating existing reports for following code ?as Jasper webservices document says you need to put argument "update=true" but it is not working.Please help me thank you ...HttpClient httpClient = new DefaultHttpClient();HttpPost request = new HttpPost("http://localhost:8082/jasperserver/rest_v2/import?update=true");request.setHeader("Cookie", jSessionId);request.setHeader("Accept", "application/json");request.setHeader("update", "true"); File fis = new File("D:\test\Reports.zip");MultipartEntity mpEntity = new MultipartEntity();ContentBody fbody = new InputStreamBody(new FileInputStream(fis), fis.getName());mpEntity.addPart("file", fbody);request.setEntity(mpEntity); HttpResponse response = httpClient.execute(request);int responseCode = response.getStatusLine().getStatusCode();System.out.println("responseCode " + responseCode); Thanks,Raviraj Link to comment Share on other sites More sharing options...
hozawa Posted June 26, 2015 Share Posted June 26, 2015 You're suppose to use "PUT" instead of "POST" to update.Pl 10.• POST to create new resources and execute reports.• PUT to modify resources (note that PUT and POST were reversed in the v1 REST API). Link to comment Share on other sites More sharing options...
rsuddhala Posted June 26, 2015 Author Share Posted June 26, 2015 Hi hozawa,As per the webservices document it says that need to use POSTPOST http://<host>:<port>/jasperserver[-pro]/rest_v2/import?<arguments>As per your suggestion I kept Put Method and I got HTTP/1.1 405 Method Not Allowed [server: Apache-Coyote/1.1, Pragma: No-cache, Cache-Control: no-cache, Expires: Thu, 01 Jan 1970 05:30:00 IST, P3P: CP="ALL", Allow: POST,GET,OPTIONS,HEAD, Content-Type: text/html;charset=utf-8, Content-Length: 1034, Date: Fri, 26 Jun 2015 12:01:35 GMT] Thanks,Raviraj 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