我想连接到Alfresco与DotCMIS,但我似乎没有得到它的工作。错误:提供的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);
}
查看DotCMIS README文件:
Web服务绑定只适用于HTTPS。. net框架不允许在纯HTTP上调用usernametoken。
这里必须使用HTTPS