anthonyraj Posted August 25, 2009 Share Posted August 25, 2009 Hi,I am currently using Jasper Server Pro version 3.5.1.While working on repository webservices, I noticed that Put operation doesn't accept PDF files as WS type.Is there a work around for this?I believe this could be added in then version of Jasper Server. Link to comment Share on other sites More sharing options...
ldangelo Posted August 26, 2009 Share Posted August 26, 2009 Here is some code that should help you out... This took a bit to figure out....this code has the pdf file in the tempLabelFile. Hope this helps! -LeoDCode: // // now put this report into the "Content files" directory of the repository ResourceDescriptor labelRD = new ResourceDescriptor(); ResourceDescriptor reportRD = new ResourceDescriptor(); Date date = new Date(); DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); try { labelRD.setName(getLabelTemplateName() + dateFormat.format(date)); labelRD.setLabel(labelRD.getName()); labelRD.setDescription(labelRD.getName()); labelRD.setParentFolder("/Reports/" + getSite().getName() + "/Content_files"); labelRD.setUriString(labelRD.getParentFolder() + "/" + labelRD.getName()); labelRD.setWsType(labelRD.TYPE_CONTENT_RESOURCE); labelRD.setResourceProperty(ResourceDescriptor.PROP_CONTENT_RESOURCE_TYPE,ResourceDescriptor.CONTENT_TYPE_PDF); labelRD.setIsNew(true); labelRD.setHasData(true); { RequestAttachment[] attachments; FileDataSource fileDataSource = new FileDataSource(tempLabelFile); RequestAttachment attachment = new RequestAttachment(fileDataSource); attachment.setContentID(labelRD.getName()); attachments = new RequestAttachment[]{attachment}; jserver.getWSClient().putResource(labelRD, attachments); } Link to comment Share on other sites More sharing options...
anthonyraj Posted August 27, 2009 Author Share Posted August 27, 2009 Thanks Leo. This helped me. :) 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