cancel
Showing results for 
Search instead for 
Did you mean: 

createFolder and 'The type is not supported by this service'

joshp
Champ in-the-making
Champ in-the-making
Hi there. I'm currently trying to migrate a large amount of CMS data from a disparate system to Alfresco. As a first step I'm trying to duplicate the folder structure from the original CMS to the Alfresco repository by utilizing Alfresco's CMIS functionality. So far I'm able to get the repository information and fire off an authenticated folder creation request (createFolder) but I'm running into an error stating:

10:16:17,301 User:admin ERROR [repo.cmis.ws] org.alfresco.error.AlfrescoRuntimeException: The type is not supported by this service: {http://www.alfresco.org/model/cmis/0.5}Folder"

The relevant code that I'm using to create this request is as follows:


    public String serviceCreateFolder(String repositoryId, String parentId) throws Exception {
        ObjectFactory objectFactory = new ObjectFactory();
       
        CmisPropertiesType folderProperties = objectFactory.createCmisPropertiesType();
        List<CmisProperty> folderPropertiesList = folderProperties.getProperty();

        folderPropertiesList = addPropertyValue(folderPropertiesList, objectFactory, "Name", "Test CMIS-created Folder");
       
        String response = this.objectServicePort.createFolder(repositoryId, "Folder", folderProperties, "workspace://SpacesStore/aeac5cce-6f36-40be-b894-b9cee182457b");
        return response;
    }
   
    private List<CmisProperty> addPropertyValue(List<CmisProperty> propertyList, ObjectFactory objectFactory, String name, String value) {
        CmisPropertyString property = objectFactory.createCmisPropertyString();

        property.setName(name);
        property.setValue(value);

        propertyList.add(property);
       
        return propertyList;
    }

(Note that workspace://SpacesStore/aeac5cce-6f36-40be-b894-b9cee182457b is a node within the repository of type {http://www.alfresco.org/model/content/1.0}folder)

And my SOAP request currently looks like this:


<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soap:mustUnderstand="1"><wsu:Timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="Timestamp-12440295"><wsu:Created xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2009-03-09T15:16:17.238Z</wsu:Created><wsu:Expires xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2009-03-09T15:21:17.238Z</wsu:Expires></wsu:Timestamp><wsse:UsernameToken xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="UsernameToken-10887413"><wsse:Username xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">admin</wsse:Username><wsse:Password xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">TOWh2S6RurKrD+LjsH/5JaiQxfc=</wsse:Password><wsse:Nonce xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">3dlDOjUtlru9Jd67gPUVKA==</wsse:Nonce><wsu:Created xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2009-03-09T15:16:17.238Z</wsu:Created></wsse:UsernameToken></wsse:Security></soap:Header><soap:Body><ns1:createFolder xmlns:ns1="http://www.cmis.org/2008/05"><ns1:repositoryId>&lt;Unknown</ns1:repositoryId><ns1:typeId>Folder</ns1:typeId><ns1:properties><ns1:propertyString ns1:name="Name"><ns1:value>Test CMIS-created Folder</ns1:value></ns1:propertyString></ns1:properties><ns1:folderId>workspace://SpacesStore/aeac5cce-6f36-40be-b894-b9cee182457b</ns1:folderId></ns1:createFolder></soap:Body></soap:Envelope>

So am I missing something very simple here? Any help would be very much appreciated.
1 REPLY 1

joshp
Champ in-the-making
Champ in-the-making
Note that I am also getting the following error when attempting to create a document utilizing createDocument:


13:46:46,566 User:admin ERROR [repo.cmis.ws] org.alfresco.error.AlfrescoRuntimeException: The type is not supported by this service: {http://www.alfresco.org/model/cmis/0.5}Document

The code for creating this document is as follows:


    public String serviceCreateDocument(String repositoryId, String parentId, String filePath, String fileName) throws Exception {
        ObjectFactory objectFactory = new ObjectFactory();
       
        CmisPropertiesType documentProperties = objectFactory.createCmisPropertiesType();
        List<CmisProperty> documentPropertiesList = documentProperties.getProperty();

        documentPropertiesList = addPropertyValue(documentPropertiesList, objectFactory, "Name", "Test CMIS-created Document");
      
        CmisContentStreamType cmisContentStreamType = objectFactory.createCmisContentStreamType();
        DataHandler handler = new DataHandler(new FileInputStream(new File(filePath + "/" + fileName)), fileName);
        cmisContentStreamType.setStream(handler);
        cmisContentStreamType.setFilename(fileName);
       
        String response = this.objectServicePort.createDocument(repositoryId, "Document", documentProperties, "workspace://SpacesStore/aeac5cce-6f36-40be-b894-b9cee182457b", cmisContentStreamType, EnumVersioningState.MAJOR);
        return response;
    }