2011-03-02 60 views
0

全部 我是一個phper和新的共享點。 我現在正在開發一個網站使用PHP和文件存儲服務與Sharepoint服務2.0 通過啓用IIS中的匿名身份驗證,可以訪問Web服務本身沒有問題。 這是我的問題。在調試我的代碼時,我不斷收到「未經授權」錯誤。 異常消息看起來像Sharepoint服務Web服務問題:未授權

 
SoapFault Object 
(
    [message:protected] => Unauthorized 
    [string:Exception:private] => 
    [code:protected] => 0 
    [file:protected] => /var/www/snippet/wsdl/index.php 
    [line:protected] => 12 
    [trace:Exception:private] => Array 
     (
      [0] => Array 
       (
        [function] => __doRequest 
        [class] => SoapClient 
        [type] => -> 
        [args] => Array 
         (
          [0] => 
Issue 

          [1] => http://192.168.56.101/sites/SPS2003/_vti_bin/Lists.asmx 
          [2] => http://schemas.microsoft.com/sharepoint/soap/GetList 
          [3] => 1 
          [4] => 0 
         ) 

       ) 

      [1] => Array 
       (
        [file] => /var/www/snippet/wsdl/index.php 
        [line] => 12 
        [function] => __call 
        [class] => SoapClient 
        [type] => -> 
        [args] => Array 
         (
          [0] => GetList 
          [1] => Array 
           (
            [0] => Array 
             (
              [listName] => Issue 
             ) 

           ) 

         ) 

       ) 

      [2] => Array 
       (
        [file] => /var/www/snippet/wsdl/index.php 
        [line] => 12 
        [function] => GetList 
        [class] => SoapClient 
        [type] => -> 
        [args] => Array 
         (
          [0] => Array 
           (
            [listName] => Issue 
           ) 

         ) 

       ) 

     ) 

    [previous:Exception:private] => 
    [faultstring] => Unauthorized 
    [faultcode] => HTTP 
    [xdebug_message] => 
SoapFault: Unauthorized in /var/www/snippet/wsdl/index.php on line 12 

Call Stack: 
    0.0004  637376 1. {main}() /var/www/snippet/wsdl/index.php:0 
    0.0006  758992 2. SoapClient->GetList(array(1)) /var/www/snippet/wsdl/index.php:12 

) 

和我的代碼片段的類似

 

$client = new SoapClient("http://192.168.56.101/sites/SPS2003/_vti_bin/Lists.asmx?wsdl"); 

try{ 
    $result = $client->GetList(array("listName" => "Issue")); 
} 
catch(Exception $e){ 
     print_r($e); 
} 

這可能是IIS配置的錯嗎? 我使用的是sharepoint服務2.0和sharepoint門戶服務器2003. 那麼,有人能幫我嗎?

在此先感謝。

回答

0

您是否在調用SharePoint Web服務時傳遞了有效憑據?

看看這個例子。這個link可能對您有所幫助。

+0

是的。我嘗試了新的SoapClient的auth_parameters並得到「http 401未授權」錯誤。然後我更改了啓用匿名身份驗證的IIS設置。結果如上。也許我應該再試一次。還是謝謝。 – AleiPhoenix 2011-03-03 03:53:59

0

好的,我終於找到了解決方案。 我需要做的就是在IIS中啓用「基本身份驗證」。它位於IIS中目錄的安全設置中。 現在我可以訪問SharePoint Web服務而無需授權問題。 希望這會幫助一些人遇到像這樣的麻煩。