sharepoint设置为使用ntlm身份验证。
当我提到
http://myserver/Sites/Ops/_vti_bin/Lists.asmx?WSDL
作为Web引用,我可以调用方法并获得有效的响应。
当我引用与服务引用相同的url时,服务器在调用方法时抛出异常。
我的帐户是sharepoint场的管理员。
这是服务引用的app.config(主要是自动生成的):
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="ListsSoap" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://myserver/Sites/Ops/_vti_bin/Lists.asmx"
binding="basicHttpBinding" bindingConfiguration="ListsSoap"
contract="SharepointLists.ListsSoap" name="ListsSoap" />
</client>
</system.serviceModel>
</configuration>
不幸的是,例外提供的唯一信息是:
“类型微软”。SharePoint。SoAsServer。SOAPServExver异常被抛出。
没有其他细节。
我使用的代码是:
public ListClass()
{
_Client = new SharepointLists.ListsSoapClient();
}
public System.Xml.Linq.XElement GetTaskList()
{
return _Client.GetList("Tasks");
}
有什么想法吗?我想使用服务引用而不是web引用。
更新:
我尝试了Rob的建议,但得到了一个错误:
HTTP GET Error
URI: http://myserver/Sites/Ops/_vti_bin/Lists.asmx
The document at the url http://myserver/Sites/Ops/_vti_bin/Lists.asmx
未被识别为已知的文档类型。
来自每个已知类型的错误消息可能有助于您解决问题:
-报告来自'
http://myserver/Sites/Ops/_vti_bin/Lists.asmx
“是”文档
无法识别格式(内容类型为“text/html;
字符集=utf-8')'。
-“DISCO文档”的报告是“下载错误”
’
http://myserver/_vti_bin/Lists.asmx?disco
“。”
-请求失败,HTTP状态为404:未找到。
-“wsdl document”中的报告是“无法识别文档格式”
(骗局)
帐篷类型为“text/html;charset=utf-8').”。
-“XML架构”中的报表为“无法识别文档格式
康登
T类型为“text/html;charset=utf-8').”。