GetRepositories(参数)抛出CmisRuntimeException [英] GetRepositories(parameters) throws CmisRuntimeException

查看:86
本文介绍了GetRepositories(参数)抛出CmisRuntimeException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我目前正在尝试使用DotCMIS / C#连接到Alfresco(DMS),以便通过我的程序从中创建/查找/检索/存档文件。

I'm currently trying to Connect to Alfresco (DMS), using DotCMIS/C#, so that I can create/locate/retrieve/archive files from it through my program.

参考: https://chemistry.apache.org/dotnet/getting-started-with-dotcmis.html

注意:我尝试了不同的 AtomPubUrl以测试哪个网址可能有效。

Note: I tried different "AtomPubUrl" to test which URL might work.

[CMIS v1.0]

对于Alfresco版本3.x: http:// [host]:[port] / alfresco / service / cmis

对于Alfresco 4.0.x和Alfresco 4.1.x: http:// [host] :[port] / alfresco / cmisatom


对于Alfresco 4.2: http:// [host]:[port] / alfresco / api / -default- /public/cmis/versions/1.0/atom

[CMIS v1.0]
For Alfresco Version 3.x: http://[host]:[port]/alfresco/service/cmis
For Alfresco 4.0.x and Alfresco 4.1.x : http://[host]:[port]/alfresco/cmisatom
For Alfresco 4.2: http://[host]:[port]/alfresco/api/-default-/public/cmis/versions/1.0/atom

[CMIS v1.1]

对于Alfresco 4.2: http:// [host]:[port] /alfresco/api/-default-/public/cmis/versions/1.1/atom

[CMIS v1.1]
For Alfresco 4.2: http://[host]:[port]/alfresco/api/-default-/public/cmis/versions/1.1/atom

这是我的代码:


Here's my code:


Dictionary< string,string>参数=新字典< string,string>();

parameters [DotCMIS.SessionParameter.BindingType] = BindingType.AtomPub;



// parameters [DotCMIS.SessionParameter.AtomPubUrl] = http:// localhost:8080 / alfresco / service / cmis ;
//抛出:未找到



/ /parameters[DotCMIS.SessionParameter.AtomPubUrl] = http:// localhost:8080 / alfresco / cmisatom;
//抛出:未经授权



// parameters [DotCMIS.SessionParameter.AtomPubUrl] = http:// localhost:8080 / alfresco / api / -default- / public / cmis / versions / 1.0 / atom;
//抛出:未经授权



// parameters [DotCMIS.SessionParameter.AtomPubUrl] = http:// localhost:8080 / alfresco / api / -default- / public / cmis / versions / 1.1 / atom;
//抛出:未经授权



参数[DotCMIS.Sessio nParameter.User] = admin;

参数[DotCMIS.SessionParameter.Password] = admin;

SessionFactory工厂= SessionFactory.NewInstance();

ISession会话= factory.GetRepositories (参数)[0] .CreateSession();


Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters[DotCMIS.SessionParameter.BindingType] = BindingType.AtomPub;

//parameters[DotCMIS.SessionParameter.AtomPubUrl] = "http://localhost:8080/alfresco/service/cmis";
//Throws: "Not Found

//parameters[DotCMIS.SessionParameter.AtomPubUrl] = "http://localhost:8080/alfresco/cmisatom";
//Throws: "Unauthorized

//parameters[DotCMIS.SessionParameter.AtomPubUrl] = "http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.0/atom";
//Throws: "Unauthorized

//parameters[DotCMIS.SessionParameter.AtomPubUrl] = "http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom";
//Throws: "Unauthorized

parameters[DotCMIS.SessionParameter.User] = "admin ";
parameters[DotCMIS.SessionParameter.Password] = "admin";
SessionFactory factory = SessionFactory.NewInstance();
ISession session = factory.GetRepositories(parameters)[0].CreateSession();

之前,我遇到了一个异常CmisRuntimeException- SendFailure ,但是现在它变成了 未找到 / 未授权

Before, I encountered an exception CmisRuntimeException - "SendFailure", but now it changes into "Not Found"/"Unauthorized".

有人可以解释我为什么会遇到这些错误吗?或我的代码有什么问题?

Can somebody explain me why am I encountering these errors? or What is wrong with my code?

谢谢!



最好的问候!



祝你有美好的一天。

Thanks in advance!

Best Regards!

Have a nice day.

推荐答案

向答案

您需要为运行的Alfresco版本使用正确的CMIS服务URL。尝试在5.x服务器上使用3.x URL不太可能。您可以在该版本的文档中找到给定版本的CMIS服务URL,也可以从 Alfresco Wiki

You need to use the correct CMIS Service URL for the version of Alfresco you are running. Trying to use the 3.x URL on a 5.x server isn't likely to work. You can find the CMIS service URL for a given version in that version's documentation, or you can get an overview of all the URLs from the Alfresco Wiki

第二,您需要向CMIS服务器进行身份验证。不必使用admin,但是您确实需要使用有效的凭据

Secondly, you'll need to be authenticating to the CMIS server. You don't have to use admin, but you do need to use valid credentials

假定您有一台4.2服务器,且管理员帐户名为管理员和密码 admin ,您可能会想要

Assuming you have a 4.2 server, with an administrator account called admin and a password of admin, you would want something like

parameters[DotCMIS.SessionParameter.AtomPubUrl] = "http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom";
parameters[DotCMIS.SessionParameter.User] = "admin ";
parameters[DotCMIS.SessionParameter.Password] = "admin";
SessionFactory factory = SessionFactory.NewInstance();
ISession session = factory.GetRepositories(parameters)[0].CreateSession();

这篇关于GetRepositories(参数)抛出CmisRuntimeException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆