Reputation: 1
Ideally I would like to download a file from a source. However I continue to get a Parsing Exception each time. Based on what I'm seeing I may not be connecting to this resource the correct way but I can't be 100% sure ...documentation on this doesn't really point me in any direction. Does the "webdav" part in this URL have anything to do with this? I have the following code:
public static void readData(String userpath) {
...
//downloadCert("sapcert3.cer");
Map<String, String> parameter = new HashMap<String, String>();
// user credentials
parameter.put(SessionParameter.USER, username);
parameter.put(SessionParameter.PASSWORD, password);
// connection settings
parameter.put(SessionParameter.ATOMPUB_URL, "https://.../alfresco/webdav/sites/imcflash/documentLibrary");
parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
// set the alfresco object factory
parameter.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");
// create session
SessionFactory factory = SessionFactoryImpl.newInstance();
List<Repository> repos = factory.getRepositories(parameter); //throws Parsing Exception here
Session session = factory.getRepositories(parameter).get(0).createSession(); //basically identical to the line above, also throws Parsing Exception
CmisObject doc = session.getObject("Flash.txt");
System.out.println("Data: " + doc.getId());
//download file code here?
}
Upvotes: 0
Views: 194
Reputation: 3235
You are using the wrong URL. This page lists all CMIS endpoints for Alfresco: https://wiki.alfresco.com/wiki/CMIS#CMIS_Service_URL
If you can, use the browser binding. It's faster and lighter and you don't need the Alfresco object factory.
Upvotes: 2