Jump to content
We've recently updated our Privacy Statement, available here ×

Unable to update reports using rest web services


rsuddhala

Recommended Posts

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

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Hi hozawa,

As per the webservices document it says that need to use POST
POST 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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...