1

can anyone tell me what are the steps, to use DotCMIS dll to view all workspaces in alfresco?

Nicolas Raoul
  • 58,567
  • 58
  • 222
  • 373
user673453
  • 167
  • 1
  • 4
  • 16

1 Answers1

3

In CMIS there's no concept of workspace. I guess you mean you want to list the Repositories. To achieve that, as shown in the official examples, you can do the following:

//
// AtomPub version
//
Dictionary<string, string> parameters = new Dictionary<string, string>();

parameters[SessionParameter.BindingType] = BindingType.AtomPub;
parameters[SessionParameter.AtomPubUrl] = "http://your.host.name/alfresco/service/cmis";
parameters[SessionParameter.User] = "admin";
parameters[SessionParameter.Password] = "admin";

SessionFactory factory = SessionFactory.NewInstance();
IList<IRepository> repos = factory.GetRepositories(parameters);

//
// WebServices version
//
Dictionary<string, string> parameters = new Dictionary<string, string>();

parameters[SessionParameter.BindingType] = BindingType.WebServices;
parameters[SessionParameter.WebServicesRepositoryService] = "http://your.host.name/alfresco/cmis/RepositoryService?wsdl";
parameters[SessionParameter.WebServicesAclService] = "http://your.host.name/alfresco/cmis/AclService?wsdl";
parameters[SessionParameter.WebServicesDiscoveryService] = "http://your.host.name/alfresco/cmis/DiscoveryService?wsdl";
parameters[SessionParameter.WebServicesMultifilingService] = "http://your.host.name/alfresco/cmis/MultifilingService?wsdl";
parameters[SessionParameter.WebServicesNavigationService] = "http://your.host.name/alfresco/cmis/NavigationService?wsdl";
parameters[SessionParameter.WebServicesObjectService] = "http://your.host.name/alfresco/cmis/ObjectService?wsdl";
parameters[SessionParameter.WebServicesPolicyService] = "http://your.host.name/alfresco/cmis/PolicyService?wsdl";
parameters[SessionParameter.WebServicesRelationshipService] = "http://your.host.name/alfresco/cmis/RelationshipService?wsdl";
parameters[SessionParameter.WebServicesVersioningService] = "http://your.host.name/alfresco/cmis/VersioningService?wsdl";
parameters[SessionParameter.User] = "admin";
parameters[SessionParameter.Password] = "admin";

SessionFactory factory = SessionFactory.NewInstance();
IList<IRepository> repos = factory.GetRepositories(parameters);
skuro
  • 13,414
  • 1
  • 48
  • 67
  • how do i find the AtomPubUrl? How can the same be done if the binding type is 'WebService' – user673453 Apr 23 '12 at 09:09
  • updated to include more real URLs. Bear in mind the WSDLs are available at `http://your.host.name/alfresco/cmis` – skuro Apr 23 '12 at 09:26
  • I am getting the following error Error: The provided URI scheme 'http' is invalid; expected 'https'. Parameter name: via – user673453 Apr 23 '12 at 09:31
  • i used the code for binding type 'WebService' and am getting the error mentioned in the above comment – user673453 Apr 23 '12 at 09:39
  • Looks like your server uses https then - you should use the https url for your server instead. Hint - you should be able to get the CMIS page up in your browser to check you've got the right URL – Gagravarr Apr 23 '12 at 09:43
  • @Gagravarr I am able to get the open the services using http://localhost:8080/alfresco/cmis/RepositoryService?wsdl. trying to open the same using http://localhost:8080/alfresco/cmis/RepositoryService?wsdl shows that page cannot be displayed. – user673453 Apr 23 '12 at 09:49
  • see http://stackoverflow.com/questions/2435823/the-provided-uri-scheme-https-is-invalid-expected-http-parameter-name-via – skuro Apr 23 '12 at 10:15