我想用 DotCMIS 连接到 Alfresco,但我似乎没有让它工作。我收到此错误“错误:提供的 URI 方案 'http' 无效;预期为 'https'。 ”我不使用 https 做任何事情,我也不想 :)
当我用谷歌搜索这个错误时,我得到了配置解决方案......但我没有将我的配置用于任何绑定或在 DotCMIS 中定义绑定名称。
我制作了一个创建错误的小示例项目。代码:
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);
}