I used alfresco Version :Community v4.0.0
I have an id of an attached file in alfresco :
abd73a24-2728-4638-9899-bb2cda9802ed
I want using cmis to Get the contents of this file
I try without success using this code :
String docId="abd73a24-2728-4638-9899-bb2cda9802ed";
Map<String, String> parameter = new HashMap<String, String>();
parameter.put(SessionParameter.USER, "admin");
parameter.put(SessionParameter.PASSWORD, "admin");
parameter.put(SessionParameter.ATOMPUB_URL, "http://192.168.1.120:8080/alfresco/cmisatom");
parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
SessionFactory factory = SessionFactoryImpl.newInstance();
Repository repository = factory.getRepositories(parameter).get(0);
Session session = repository.createSession();
System.out.println("Connected to repository:" + session.getRepositoryInfo().getName());
System.out.println("Repository id:"+session.getRepositoryInfo().getId());
// Get the contents of the file
Document doc = (Document) session.getObject(docId);
this is the error
Connected to repository:Main Repository
Repository id:516c4b81-f9d6-44fc-94b7-7c7f70c79ade
Exception in thread "main" org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException: Object id is invalid: abd73a24-2728-4638-9899-bb2cda9802ed
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:423)
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.read(AbstractAtomPubService.java:554)
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.getObjectInternal(AbstractAtomPubService.java:778)
at org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.getObject(ObjectServiceImpl.java:481)
at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObject(SessionImpl.java:393)
at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObject(SessionImpl.java:371)
I used this lib in my project
using the navigator and using this url :
http://192.168.1.120:9080/alfresco/d/d/workspace/SpacesStore/
abd73a24-2728-4638-9899-bb2cda9802ed/test.txt
I can open the file
Try appending store ref to the id (protocol + identifier):
workspace://SpacesStore/abd73a24-2728-4638-9899-bb2cda9802ed