调用 GetListItems Web 服务的 SharePoint SoapServerException [英] SharePoint SoapServerException calling GetListItems web service

查看:45
本文介绍了调用 GetListItems Web 服务的 SharePoint SoapServerException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码中有以下语句:

System.Xml.XmlNode items = lstWebs.GetListItems(任务",string.Empty,listQuery,listViewFields,string.Empty, listQueryOptions, WorkspaceId);

执行此操作时,出现以下异常:

<前>抛出了Microsoft.SharePoint.SoapServer.SoapServerException"类型的异常.异常源是:系统.网络.服务堆栈跟踪:在 System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage 消息,WebResponse 响应,Stream responseStream,Boolean asyncCall)在 System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)在 ImpersonationConsoleApp.MossLists.Lists.GetListItems(String listName, String viewName, XmlNode query, XmlNode viewFields, String rowLimit, XmlNode queryOptions, String webID) 在 C:\Documents and Settings\david\My Documents\_Dew02SiteCreator\DeWProjectStarter\oleImpersonationReferences\MossLists\Reference.cs:line 435在 ImpersonationConsoleApp.Program.DeleteTasksIfNotExist(DataRow[] drTasksdel, String siteURL) 在 C:\Documents and Settings\david\My Documents\_Dew02SiteCreator\DeWProjectStarter\ImpersonationConsoleApp\Program.cs:line 1384

我已经确认了网站 URL,没有问题.

你能帮忙解释一下为什么会发生异常吗?我需要重置 IIS 吗?

请查收详情.

SoapException.InnerException 为 Null.但是,soapExcetion.Detail.InnerText 显示:系统找不到指定的文件.(来自 HRESULT 的异常:0x80070002)

解决方案

GetListItems 的签名是

GetListItems(ListID, "", queryNode, viewFieldsNode, Nothing, queryOptionsNode, Nothing)

尝试将 queryNode、viewFieldsNode 和 queryOptionsNode 简化到最小.

在 VB.NET 中

Dim caml = 新建 XmlDocumentDim queryNode = caml.CreateElement("查询")Dim viewFieldsNode = caml.CreateElement("ViewFields")Dim queryOptionsNode = caml.CreateElement("QueryOptions")queryOptionsNode.InnerXml = "<ViewAttributes Scope=""Recursive""/><IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns>"

在 C# 中

var caml = new XmlDocument();var queryNode = caml.CreateElement("查询");var viewFieldsNode = caml.CreateElement("ViewFields");var queryOptionsNode = caml.CreateElement("QueryOptions");queryOptionsNode.InnerXml = "<ViewAttributes Scope=\"Recursive\"/><IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns>";

如果正常,则网络服务设置正确.

当我遇到上述问题时,是我无效的 XML 导致的.queryNode 中Where"元素的Value"元素缺少type"属性.我是从 Microsoft 在这里找到的.

<块引用>

类型 |必需的文本.指定此元素包含的值的数据类型.

它在添加类型属性后工作.检查上述节点之一中的 xml 是否缺少任何要求?

I have the following statement in my code:

System.Xml.XmlNode items = lstWebs.GetListItems(
    "Tasks", string.Empty, listQuery, listViewFields,
    string.Empty, listQueryOptions, WorkspaceId);

When executing this, the following exception occurs:

Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.

Exception Source is:
System.Web.Services

Stack Trace:
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
   at ImpersonationConsoleApp.MossLists.Lists.GetListItems(String listName, String viewName, XmlNode query, XmlNode viewFields, String rowLimit, XmlNode queryOptions, String webID) in C:\Documents and Settings\david\My Documents\_Dew02SiteCreator\DeWProjectStarter\ImpersonationConsoleApp\Web References\MossLists\Reference.cs:line 435
   at ImpersonationConsoleApp.Program.DeleteTasksIfNotExist(DataRow[] drTasksdel, String siteURL) in C:\Documents and Settings\david\My Documents\_Dew02SiteCreator\DeWProjectStarter\ImpersonationConsoleApp\Program.cs:line 1384

I have confirmed the site URL and it is fine.

Could you please help on why the exception is occurring? Do I need to reset IIS?

please find the detail.

SoapException.InnerException is Null. 
However the soapExcetion.Detail.InnerText is showing: The system cannot find the file specified. (Exception from HRESULT: 0x80070002) 

解决方案

The signature for GetListItems is

GetListItems(ListID, "", queryNode, viewFieldsNode, Nothing, queryOptionsNode, Nothing)

Try simplifying queryNode, viewFieldsNode and queryOptionsNode to the minimal.

In VB.NET

Dim caml = New XmlDocument
Dim queryNode = caml.CreateElement("Query") 
Dim viewFieldsNode = caml.CreateElement("ViewFields")
Dim queryOptionsNode = caml.CreateElement("QueryOptions")
queryOptionsNode.InnerXml = "<ViewAttributes Scope=""Recursive"" /><IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns>"

In C#

var caml = new XmlDocument();
var queryNode = caml.CreateElement("Query");
var viewFieldsNode = caml.CreateElement("ViewFields");
var queryOptionsNode = caml.CreateElement("QueryOptions");
queryOptionsNode.InnerXml = "<ViewAttributes Scope=\"Recursive\" /><IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns>";

If it works, then the web service setup is correct.

When I had the mentioned problem, it was my invalid XML that caused it. There is a missing 'type' attribute on the 'Value' element of the 'Where' element in queryNode. I found it here from Microsoft.

Type | Required Text. Specifies the data type for the value contained by this element.

It works after adding the Type attribute. Check if any missing requirements for the xml in one of the nodes mentioned above?

这篇关于调用 GetListItems Web 服务的 SharePoint SoapServerException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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