Hi everyone,I'm facing a really awkward situation here. I'm trying to create a Folder in Alfresco 3.1.1 EE via CMIS but an empty document gets created instead.In order to see exactly where the problem lies, I've output the contents of the Get Request, before it gets fired against Alfresco. I also printed Alfresco's response and I'm absolutely baffled by the dissimilarities between the two.Here's my request:
<?xml version="1.0" encoding="utf-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200901">
<title>ReallyMyFOLDER1253535827322</title>
<summary>ReallyMyFOLDER1253535827322 (summary)</summary>
<cmis:object>
<cmis:properties>
<cmis:propertyString cmis:name="ObjectTypeId"><cmis:value>folder</cmis:value></cmis:propertyString>
</cmis:properties>
</cmis:object>
</entry>
And here is what Alfresco says it created:
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns:cmis="http://www.cmis.org/2008/05" xmlns:alf="http://www.alfresco.org">
<author><name>admin</name></author>
<content type="application/octet-stream" src="http://localhost:8080/alfresco/service/api/node/workspace/SpacesStore/e42dea28-e2cb-4037-9f59-0839c18794a4/content.ReallyMyFOLDER1253535827322'/><id>urn:uuid:e42dea28-e2cb-4037-9f59-0839c18794a4</id>
<link rel="self" href="http://localhost:8080/alfresco/service/api/node/workspace/SpacesStore/e42dea28-e2cb-4037-9f59-0839c18794a4'/>
<link rel="enclosure" type="application/octet-stream" href="http://localhost:8080/alfresco/service/api/node/workspace/SpacesStore/e42dea28-e2cb-4037-9f59-0839c18794a4/content.ReallyMyFOLDER1253535827322'/><link rel="edit" href="http://localhost:8080/alfresco/service/api/node/workspace/SpacesStore/e42dea28-e2cb-4037-9f59-0839c18794a4'/>
<link rel="edit-media" type="application/octet-stream" href="http://localhost:8080/alfresco/service/api/node/workspace/SpacesStore/e42dea28-e2cb-4037-9f59-0839c18794a4/content.ReallyMyFOLDER1253535827322'/><link rel="cmis-allowableactions" href="http://localhost:8080/alfresco/service/api/node/workspace/SpacesStore/e42dea28-e2cb-4037-9f59-0839c18794a4/permissions'/>
<link rel="cmis-relationships" href="http://localhost:8080/alfresco/service/api/node/workspace/SpacesStore/e42dea28-e2cb-4037-9f59-0839c18794a4/associations'/>
<link rel="cmis-parents" href="http://localhost:8080/alfresco/service/api/node/workspace/SpacesStore/e42dea28-e2cb-4037-9f59-0839c18794a4/parents'/>
<link rel="cmis-allversions" href="http://localhost:8080/alfresco/service/api/node/workspace/SpacesStore/e42dea28-e2cb-4037-9f59-0839c18794a4/versions'/>
<link rel="cmis-stream" type="application/octet-stream" href="http://localhost:8080/alfresco/service/api/node/workspace/SpacesStore/e42dea28-e2cb-4037-9f59-0839c18794a4/content.ReallyMyFOLDER1253535827322'/><link rel="cmis-type" href="http://localhost:8080/alfresco/service/api/type/document'/>
<link rel="cmis-repository" href="http://localhost:8080/alfresco/service/api/repository'/>
<published>2009-09-21T12:23:47.836Z</published>
<summary>ReallyMyFOLDER1253535827322 (summary)</summary>
<title>ReallyMyFOLDER1253535827322</title>
<updated>2009-09-21T12:23:48.061Z</updated>
<cmis:object>
<cmis:properties>
<cmis:propertyId cmis:name="ObjectId"><cmis:value>workspace://SpacesStore/e42dea28-e2cb-4037-9f59-0839c18794a4</cmis:value></cmis:propertyId>
<cmis:propertyString cmis:name="BaseType"><cmis:value>document</cmis:value></cmis:propertyString>
<cmis:propertyString cmis:name="ObjectTypeId"><cmis:value>document</cmis:value></cmis:propertyString>
<cmis:propertyString cmis:name="CreatedBy"><cmis:value>admin</cmis:value></cmis:propertyString>
<cmis:propertyDateTime cmis:name="CreationDate"><cmis:value>2009-09-21T12:23:47.836Z</cmis:value></cmis:propertyDateTime>
<cmis:propertyString cmis:name="LastModifiedBy"><cmis:value>admin</cmis:value></cmis:propertyString>
<cmis:propertyDateTime cmis:name="LastModificationDate"><cmis:value>2009-09-21T12:23:48.061Z</cmis:value></cmis:propertyDateTime>
<cmis:propertyString cmis:name="Name"><cmis:value>ReallyMyFOLDER1253535827322</cmis:value></cmis:propertyString>
<cmis:propertyBoolean cmis:name="IsImmutable"><cmis:value>false</cmis:value></cmis:propertyBoolean>
<cmis:propertyBoolean cmis:name="IsLatestVersion"><cmis:value>true</cmis:value></cmis:propertyBoolean>
<cmis:propertyBoolean cmis:name="IsMajorVersion"><cmis:value>false</cmis:value></cmis:propertyBoolean>
<cmis:propertyBoolean cmis:name="IsLatestMajorVersion"><cmis:value>false</cmis:value></cmis:propertyBoolean>
<cmis:propertyString cmis:name="VersionLabel"/>
<cmis:propertyId cmis:name="VersionSeriesId"><cmis:value>workspace://SpacesStore/e42dea28-e2cb-4037-9f59-0839c18794a4</cmis:value></cmis:propertyId>
<cmis:propertyBoolean cmis:name="IsVersionSeriesCheckedOut"><cmis:value>false</cmis:value></cmis:propertyBoolean>
<cmis:propertyString cmis:name="VersionSeriesCheckedOutBy"/>
<cmis:propertyId cmis:name="VersionSeriesCheckedOutId"/>
<cmis:propertyString cmis:name="CheckinComment"/>
<cmis:propertyInteger cmis:name="ContentStreamLength"><cmis:value>0</cmis:value></cmis:propertyInteger>
<cmis:propertyString cmis:name="ContentStreamMimeType"><cmis:value>application/octet-stream</cmis:value></cmis:propertyString>
<cmis:propertyString cmis:name="ContentStreamFilename"><cmis:value>ReallyMyFOLDER1253535827322</cmis:value></cmis:propertyString>
<cmis:propertyString cmis:name="ContentStreamURI"><cmis:value>http://localhost:8080/alfresco/service/api/node/workspace/SpacesStore/e42dea28-e2cb-4037-9f59-0839c18794a4/content.ReallyMyFOLDER1253535827322</cmis:value></cmis:propertyString>
</cmis:properties>
</cmis:object>
<cmis:terminator/>
<app:edited>2009-09-21T12:23:48.061Z</app:edited>
<alf:icon>http://localhost:8080/alfresco/images/filetypes/_default.gif</alf:icon>
</entry>
Here is my Java-Method.public Entry createFolder(IRI parent, String name, String atomEntryFile) throws Exception {
String createFolder = templates.load(atomEntryFile == null ? "createfolder.atomentry.xml" : atomEntryFile);
createFolder = createFolder.replace("${NAME}", name);
Request req = new PostRequest(parent.toString(), createFolder, CMISConstants.MIMETYPE_ATOMENTRY); //the constant is "application/atom+xml;type=entry"
Response res = executeRequest(req, 201, cmisValidator.getCMISAtomValidator());
String xml = res.getContentAsString();
Entry entry = appModel.parseEntry(new StringReader(xml), null);
CMISObject object = entry.getExtension(CMISConstants.OBJECT);
String testFolderHREF = (String) res.getHeader("Location");
return entry;
}
So, I obviously tell Alfresco: "Make me a folder", to which Alfresco replies: "Ok, I'll make you an empty document, with <content type="application/octet-stream" …>"I suppose I'm doing something wrong here, since Alfresco's own tests seem to be working quite well indeed. I've compared my code stack with the one used by the Alfresco's own tests (org.alfresco.repo.cmis.rest.test.CMISTest.java from SVN) and I have been unable to spot any differences between the two. I am pretty much stuck here. Any input would be much appreciated. Thanks!Max