2016-10-13 114 views
0

我試圖使用SharePoint 2013 Web服務(GetListItems)。SharePoint 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

+0

您是否嘗試過使用驗證'ALT + v'組合鍵或右鍵單擊並驗證在soapUI的編輯要求?錯誤信息在迴應中說問題'元素的參數查詢丟失或無效' – Rao

回答

0

我從來沒有使用的Sharepoint但是,根據錯誤消息和您提供問題的鏈接顯然是您的請求不會根據模式進行驗證。

我認爲這個問題是與節點的名字和你的要求節點的命名空間。使http://schemas.microsoft.com/sharepoint/soap/爲您的請求的默認名稱空間,並大寫一些節點名稱(在您提供鏈接的示例中,使用<Query>而不是<query>,<ViewFields>而不是<viewField>),因爲它是一個可選元素,所以您也可以刪除<WebID>它是空的。

可能是更多的錯誤,但你可以嘗試:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://schemas.microsoft.com/sharepoint/soap/"> 
    <soapenv:Body> 
     <GetListItems> 
     <ListName>OnLineFormsList</ListName> 
     <Query> 
      <Where> 
       <Eq> 
       <FieldRef Name="Item Type" /> 
       <Value Type="String">Personal</Value> 
       </Eq> 
      </Where> 
     </Query> 

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

     <RowLimit>50</RowLimit> 

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

     </GetListItems> 
    </soapenv:Body> 
</soapenv:Envelope> 
+0

感謝您的工作!儘管現在我確實收到了403 FORBIDDEN錯誤。 – Brian

+0

@Brian很高興幫助你,但是正如我告訴過你的,我從來沒有用過* sharepoint *,所以我只能幫你糾正你的* xml *請求,但我不知道你要檢查你的服務器避免* forbbiden *當然你錯過了一些憑證或客戶端證書認證。 – albciff