我嘗試通過iOS HTTP調用訪問Sharepoint 2007 Web服務。通信協議是SOAP(1和1.2)。我能夠成功執行GetList和GetListAndView。但是,當我嘗試GetListItems時,我得到任何數量的錯誤消息,其中沒有任何意義。Sharepoint 2007 Web服務錯誤
SOAP調用的格式(1.2在這種情況下,但存在1.0同樣的問題)爲GetListItems是這樣的:
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<GetListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<listName>TaskListSample2-0</listName>
<viewName>{13C5392C-7DBC-4803-A3B8-B377D8566A55}</viewName>
<query><Query><Where><Or><Eq><FieldRef Name="Title"></FieldRef><Value Type="Text">Test</Value></Eq><IsNotNull><FieldRef Name="Title"></FieldRef></IsNotNull></Or></Where></Query></query>
<viewFields><ViewFields><FieldRef Name="Title" /><FieldRef Name="Status" /></ViewFields></viewFields>
<rowLimit>100</rowLimit>
<queryOptions></queryOptions>
<webID>c069106a-8d18-43d6-81c2-2687f568a3c5</webID>
</GetListItems>
</soap12:Body>
</soap12:Envelope>
<Query>...</Query>
之間的內容的結構,因爲它是完全一樣的格式化成一個成功的.Net調用這個函數。
我收到以下錯誤信息回:
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<soap:Fault>
<soap:Code>
<soap:Value>soap:Receiver</soap:Value>
</soap:Code>
<soap:Reason>
<soap:Text xml:lang="en">Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.</soap:Text>
</soap:Reason>
<detail>
<errorstring xmlns="http://schemas.microsoft.com/sharepoint/soap/">Root element is missing.</errorstring>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>
我花了天這個,與其他幾個程序員誰是在.net和Sharepoint精通一起。根據對查詢的各種編輯更改,我們還看到「查詢中的元素<Query>
已丟失或無效。」
順便說一下,我還試圖通過Windows盒子上的Fiddler2來調用所有這些SOAP調用。我看到與iOS HTTP調用相同的確切結果。
我已經能夠得到最接近的答案是查詢格式不正確(杜)。但在我的生活中,正確的格式正在逃避我們。我們已經能夠成功地從本地.Net應用程序查詢服務器,但是將查詢XML的確切內容和格式複製到iOS代碼中並不會改變任何內容。
不用說,微軟的文檔和錯誤信息是無用的。不,我們不能遷移到MOSS 2010.客戶不會很快更新,所以我們必須使用他們已有的技術。
任何幫助都會令人難以置信的讚賞。即使有人能夠明確地證明2007年特定的Web服務功能被破壞了。雖然它會吸引人,但至少我們知道我們並不是完全愚蠢的。但是,如果任何人都可以確定我實際上格式化查詢錯誤,並告訴我如何解決這個問題,那將會很棒。
謝謝。