AnsweredAssumed Answered

Unable to create folder via OpenCMIS

Question asked by unknown-user on Apr 28, 2010
Latest reply on May 4, 2010 by unknown-user
I am doing some basic exploration of CMIS and Alfresco.  I am running Alfresco 3.3. Community Edition locally and most things have worked well.
Currently I am trying to use OpenCMIS.  I am able to login, get repository information and navigate without issue; what I can't seem to do is create a folder.  I have tried two different ways, both using the web service bindings:
Folder root = cmisSession.getRootFolder();

Map<String,String> newFolderProps = new HashMap<String, String>();
newFolderProps.put(PropertyIds.CMIS_OBJECT_TYPE_ID, "cmis:folder");
newFolderProps.put(PropertyIds.CMIS_NAME, "Test Folder 1");

//Method 1
Folder newFolder = root.createFolder(newFolderProps, null, null, null, cmisSession.getDefaultContext());

//Method 2
ObjectId rootId = cmisSession.createObjectId(root.getId());
ObjectId newFolderId = cmisSession.createFolder(newFolderProps, rootId, null, null, null);
Folder newFolder = (Folder)cmisSession.getObject(newFolderId);

For both methods, I get the following exception:
Exception in thread "main" org.apache.opencmis.commons.exceptions.CmisInvalidArgumentException: Type Id property required
   at org.apache.opencmis.client.provider.spi.webservices.AbstractWebServicesService.convertException(AbstractWebServicesService.java:83)
   at org.apache.opencmis.client.provider.spi.webservices.ObjectServiceImpl.createFolder(ObjectServiceImpl.java:166)
   at org.apache.opencmis.client.runtime.PersistentFolderImpl.createFolder(PersistentFolderImpl.java:178)
   at OpenCMISTest.runTest(OpenCMISTest.java:138)
   at OpenCMISTest.main(OpenCMISTest.java:120)

I can't seem to find any information on what this means, any examples of using the OpenCMIS "createFolder" method or documentation on it.  Does anyone have any idea as to what I am doing wrong?  I have searched and searched but can't find the answer.

I guess option might be to go via the Atom bindings to see if there is any difference.

Outcomes