03-15-2012 12:30 PM
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"03-15-2012 12:55 PM
01-15-2013 01:37 AM
Is versionState of null valid?
properties.put("cm:description", "My document");
document is uploading successfully.01-15-2013 05:05 AM
01-16-2013 04:26 PM
01-18-2013 03:05 PM
08-27-2014 11:43 PM
..
parameter.put(SessionParameter.ATOMPUB_URL, "http://localhost:8101/alfresco/service/cmis");
parameter.put(SessionParameter.BINDING_TYPE,BindingType.ATOMPUB.value());
parameter.put(SessionParameter.OBJECT_FACTORY_CLASS,"org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");
metadata.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document,P:cm:titled");
metadata.put("cm:description", "DY Description");
//metadata is something like: {cm:description=DY Description, cmis:objectTypeId=cmis:document,P:cm:titled, cmis:name=Some Benefits Guide}
try{
document = parentFolder.createDocument(metadata, contentStream, null); //This throws the error
….
…
} catch (CmisInvalidArgumentException ciae) {
//…IT COMES HERE Saying :
//org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException: Bad Request
}
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.