Sharepoint service web service problem: Unauthorized
all I'm a phper and new to sharepoint. I'm now developing a website using php and file storage service with sharepoint service 2.0 By enabling anonymous authentication in IIS, the web service itself can be accessed to with no problems. Here's my question. When debugging my code, I keeping receiving "Unauthorized" error. The exception message looks like
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 )
and my code snippet's something like
$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); }
Could it be the IIS configuration's fault? I'm using sharepoint service 2.0 and sharepoint portal server 2003. So, could anyone help me out?
Thanks in advance.
Did you passed valid credentials while calling your SharePoint webservice?
Have a look at this sample. This link might be helpful to you.
OK, I've found the solution at last. All I need to do is to enable "Basic authentication" in IIS. It's in the security setting of directory in IIS. Now I can get access to the sharepoint web service without authority problems. Hope this would help some guys encounter the same trouble like this.
精彩评论