Hello!I try to set the cm:descripion properties by a document/folder by using openCMIS in alfresco.My test code is:
public class Testing
{
public static void main(String args[])
{
System.out.println(Testing.class.getName() + " started");
SessionFactory sessionFactory = SessionFactoryImpl.newInstance();
Map<String, String> parameter = new HashMap<String, String>();
parameter.put(SessionParameter.USER, "admin");
parameter.put(SessionParameter.PASSWORD, "admin");
parameter.put(SessionParameter.BINDING_TYPE,
BindingType.ATOMPUB.value());
parameter.put(SessionParameter.ATOMPUB_URL,
"http://127.0.0.1:8080/alfresco/service/cmis");
try
{
List<Repository> repositories = sessionFactory.getRepositories(parameter);
Repository repository = repositories.get(0);
Session session = repository.createSession();
session.getDefaultContext().setCacheEnabled(false);
System.out.println("Got a connection to repository: " + repository.getName() + ", with id: "
+ repository.getId());
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(PropertyIds.NAME, "doc1");
properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document,P:cm:titled");
properties.put("cm:description", "My document");
Document doc = session.getRootFolder().createDocument(properties, null, null);
}
catch (CmisRuntimeException ex)
{
ex.printStackTrace();
}
System.out.println(Testing.class.getName() + " ended");
}
}
but the output is droped by a exception with "org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException: Bad Request"in the row "Document doc = session.getRootFolder().createDocument(properties, null, null);"What is wrong in this case, please help me!
:?: