我試圖通過用PHP編寫的Web服務來檢索列表在SharePoint 2007中的數據:下載ASMX列表文件並把它們作爲WSDL文件+的SharePoint
<?php
//Authentication details
$authParams = array('login' => 'username', 'password' => 'password' , "authentication" => SOAP_AUTHENTICATION_DIGEST);
/* A string that contains either the display name or the GUID for the list.
* It is recommended that you use the GUID, which must be surrounded by curly
* braces ({}).
*/
$listName = "Testlist";
$rowLimit = '150';
/* Local path to the Lists.asmx WSDL file (localhost). You must first download
* it manually from your SharePoint site (which should be available at
* yoursharepointsite.com/subsite/_vti_bin/Lists.asmx?WSDL)
*/
$wsdl = "http://localhost/phpsp/Lists.wsdl";
//Creating the SOAP client and initializing the GetListItems method parameters
$soapClient = new SoapClient($wsdl, $authParams);
$params = array('listName' => $listName, 'rowLimit' => $rowLimit);
//Calling the GetListItems Web Service
$rawXMLresponse = null;
try{
$rawXMLresponse = $soapClient->GetListItems($params)->GetListItemsResult->any;
}
catch(SoapFault $fault){
echo 'Fault code: '.$fault->faultcode;
echo 'Fault string: '.$fault->faultstring;
}
echo '<pre>' . $rawXMLresponse . '</pre>';
..
..
?>
我有在共享點和網址中創建的列表,列表顯示顯示「.asmx」擴展名。我如何手動下載列表並將其用作'.wsdl',就像這個示例代碼中所做的那樣。
我搜索了相同的過網和人們告訴其可以在獲得:
sharepoint.url/subsite/_vti_bin/Lists.asmx?WSDL
但是,我是不是能夠得到的.wsdl文件。
如果你複製/粘貼'的SharePoint。 url/subsite/_vti_bin/Lists.asmx?WSDL'直接在瀏覽器中?它會爲你打開WSDL嗎?我剛剛在Live WSS 3.0網站上進行了測試,它確實爲我提供了一個WSDL文件。 –
看到這個已經被我的本地sharepoint列表url的權利所取代..?我嘗試了各種情況。但總是有空白頁面。 http://192.168.1.197/TestURL/Lists/Testlist/AllItems.aspx給我列表顯示,所以我嘗試像這樣:http://192.168.1.197/TestURL/_vti_bin/Lists.asmx?WSDL。 ip是我的本地windows服務器。 – clint
你使用了什麼瀏覽器?單擊空白頁上的查看源並查看WSDL文件是否在那裏。 –