Jump to content

JasperServer - Repository WebServices


anthonyraj

Recommended Posts

 

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

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

 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!

 

-LeoD

Code:
		//		// 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

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...