Question

I want to connect to Alfresco with DotCMIS but I dont seem to get it working. I get this error "Error: The provided URI scheme 'http' is invalid; expected 'https'." I don't do anything with https and I don't want to either :)

When I Google for this error I get configuration solutions... but I don't use my configuration for any binding or define a binding name in DotCMIS.

I've made a little example project that creates the error. CODE:

private static void Main(string[] args)
        {
            string user = "admin";
            string password = "pass";
            string serviceUrl = "http://localhost:port/alfresco/cmis/";
            string objectType = "D:my:objectType";
            string repositoryid = "repositoryId";

            Connector con = new Connector();
            con.Connect(user, password, serviceUrl, repositoryid, objectType);
        }
    }

    public class Connector
    {
        public void Connect(
            string user, string password, string servicesUrl,
            string repositoryId, string objectTypeId_0)
        {
            // default factory implementation
            IDictionary<string, string> parameter = new Dictionary<string, string>();

            // user credentials
            parameter.Add((System.String) (DotCMIS.SessionParameter.User), (System.String) (user));
            parameter.Add((System.String) (DotCMIS.SessionParameter.Password), (System.String) (password));

            // connection settings
            parameter.Add(
                (System.String) (DotCMIS.SessionParameter.BindingType),
                (System.String) (DotCMIS.BindingType.WebServices.ToString()));

            parameter.Add(
                (System.String) (DotCMIS.SessionParameter.WebServicesAclService), (System.String) (servicesUrl
                                                                                                   + "ACLService?wsdl"));
            parameter.Add(
                (System.String) (DotCMIS.SessionParameter.WebServicesDiscoveryService),
                (System.String) (servicesUrl + "DiscoveryService?wsdl"));
            parameter.Add(
                (System.String) (DotCMIS.SessionParameter.WebServicesMultifilingService),
                (System.String) (servicesUrl + "MultiFilingService?wsdl"));
            parameter.Add(
                (System.String) (DotCMIS.SessionParameter.WebServicesNavigationService),
                (System.String) (servicesUrl + "NavigationService?wsdl"));
            parameter.Add(
                (System.String) (DotCMIS.SessionParameter.WebServicesObjectService), (System.String) (servicesUrl
                                                                                                      +
                                                                                                      "ObjectService?wsdl"));
            parameter.Add(
                (System.String) (DotCMIS.SessionParameter.WebServicesPolicyService), (System.String) (servicesUrl
                                                                                                      +
                                                                                                      "PolicyService?wsdl"));
            parameter.Add(
                (System.String) (DotCMIS.SessionParameter.WebServicesRelationshipService),
                (System.String) (servicesUrl + "RelationshipService?wsdl"));
            parameter.Add(
                (System.String) (DotCMIS.SessionParameter.WebServicesRepositoryService),
                (System.String) (servicesUrl + "RepositoryService?wsdl"));
            parameter.Add(
                (System.String) (DotCMIS.SessionParameter.WebServicesVersioningService),
                (System.String) (servicesUrl + "VersioningService?wsdl"));
            parameter.Add((System.String) (DotCMIS.SessionParameter.RepositoryId), (System.String) (repositoryId));


            ISessionFactory factory = DotCMIS.Client.Impl.SessionFactory.NewInstance();

            ISession session = factory.CreateSession(parameter);
        }
Was it helpful?

Solution

Check the DotCMIS README file:

The Web Services binding only works with HTTPS. The .NET framework does not allow calls with UsernameTokens over plain HTTP.

You have to use HTTPS here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top