SharePoint Web服务 - GetListItems

时间:2016-10-13 09:20:43

标签: web-services soap sharepoint-2013 soapui

我正在尝试使用SharePoint 2013 Web服务(GetListItems)。

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.microsoft.com/sharepoint/soap/">
   <soapenv:Header/>
   <soapenv:Body>
      <soap:GetListItems>

         <soap:listName>OnLineFormsList</soap:listName>

         <soap:query>
            <Where>
              <Eq>
                 <FieldRef Name="Item Type" />
                 <Value Type="String">Personal</Value>
              </Eq>
             </Where>
         </soap:query>

         <viewFields>
           <FieldRef Name="Process ID" />
           <FieldRef Name="Title" />
           <FieldRef Name="Description" />
         </viewFields>

         <soap:rowLimit>50</soap:rowLimit>

         <queryOptions xmlns:SOAPSDK9=
              "http://schemas.microsoft.com/sharepoint/soap/" >
           <QueryOptions/>
        </queryOptions>

         <soap:webID></soap:webID>
      </soap:GetListItems>
   </soapenv:Body>
</soapenv:Envelope>

我是从SoapUI尝试这个。我收到以下错误消息:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:Server</faultcode>
         <faultstring>Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.</faultstring>
         <detail>
            <errorstring xmlns="http://schemas.microsoft.com/sharepoint/soap/">Element &lt;Query> of parameter query is missing or invalid.</errorstring>
            <errorcode xmlns="http://schemas.microsoft.com/sharepoint/soap/">0x82000000</errorcode>
         </detail>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>

有人能指出如何正确使用此服务吗?

列表列:

List Columns

查看:所有项目(默认项目)

我按照此链接上的说明操作:https://msdn.microsoft.com/en-us/library/lists.lists.getlistitems(v=office.12).aspx

1 个答案:

答案 0 :(得分:0)

我从未使用 Sharepoint 但是根据错误消息和您提供的链接,问题显然是您的请求未针对架构进行验证。

我认为问题在于请求节点的节点名称和名称空间。将http://schemas.microsoft.com/sharepoint/soap/设置为您的请求的默认命名空间,并将某些节点名称大写(在您提供的链接的示例中使用<Query>代替<query><ViewFields>而不是{ {1}}),您也可以删除<viewField>,因为它是一个可选元素,在您的情况下它是空的。

可能有更多错误,但您可以尝试:

<WebID>