AnsweredAssumed Answered

Bug in webservice of 1.1.2?

Question asked by cburghardt on Dec 28, 2005
Latest reply on Jan 18, 2006 by rwetherall
I try to create a new content node of type pdf with the following code:

NamedValue[] props = new NamedValue[] {new NamedValue("{http://www.alfresco.org/model/content/1.0}name", name)};
CMLCreate create = new CMLCreate(name, parentReference, "{http://www.alfresco.org/model/content/1.0}content", props);
CML cml = new CML();
cml.setCreate(new CMLCreate[]{create});
UpdateResult[] result = repositoryService.update(cml);
Reference newContentNode = result[0].getDestination();
ContentFormat format = new ContentFormat("application/pdf", "UTF-8");
byte[] bytes = IOUtils.toByteArray(new FileInputStream("test.pdf"));
contentService.write(newContentNode, "{http://www.alfresco.org/model/content/1.0}content", bytes, format);

The result is a pdf file that contains the correct number of pages but no text. If I upload this file via Webclient everything is ok. Text nodes (like in the webservice example) also work. The size of the created node is too big so I guess there is some encoding problem.

Outcomes