2012-12-20 61 views
0

我刚熟悉使用Exchange Web服务(EWS)和Web上提供的准则(例如Talking SOAP with Exchange)。PHP - 连接到Exchange Web服务的问题

我有一个测试服务器,我正在得到正确的响应。当我移动exact same files到生产服务器我得到下面的PHP通知无反应(空白页):

Notice: Trying to get property of non-object in index.php on line 48 

的index.php线44〜48:

44 - $FindFolder->Traversal = 'Shallow'; 
    45 - $FindFolder->FolderShape->BaseShape = 'AllProperties'; 
    46 - $FindFolder->ParentFolderIds->DistinguishedFolderId->Id = 'root'; 
    47 - $result = $client->FindFolder($FindFolder); 
    48 - $folders = $result->ResponseMessages->FindFolderResponseMessage->RootFolder->Folders->Folder; 

一个var_dump($client)线47后返回正确的数据。但是,在将Class对象转换为line 47: $result = $client->...中的变量后,var_dump($result)返回NULL(在生产服务器上,但测试服务器中已满)。

我知道PHP类是区分大小写的,但这种情况对我来说似乎是正确的,而且这种情况对测试服务器有效。

任何想法?

更新#1

我增加了有关var_dumps追踪此问题的详情。这些转储都放置线47后:

的var_dump($ FindFolder)

object(stdClass)#2 (3) { ["Traversal"]=> string(7) "Shallow" ["FolderShape"]=> 
object(stdClass)#3 (1) { ["BaseShape"]=> string(13) "AllProperties" } ["ParentFolderIds"]=> 
object(stdClass)#4 (1) { ["DistinguishedFolderId"]=> object(stdClass)#5 (1) { ["Id"]=> 
string(4) "root" } } } 

的var_dump($客户端)

object(ExchangeNTLMSoapClient)#1 (5) { ["user":protected]=> string(6) "***hidden***" 
["password":protected]=> string(8) "***hidden***" ["_soap_version"]=> int(1) ["sdl"]=> 
resource(3) of type (Unknown) ["__last_request_headers"]=> array(5) { [0]=> string(12) 
"Method: POST" [1]=> string(22) "Connection: Keep-Alive" [2]=> string(25) "User-Agent: 
PHP-SOAP-CURL" [3]=> string(37) "Content-Type: text/xml; charset=utf-8" [4]=> string(85) 
"SOAPAction: "http://schemas.microsoft.com/exchange/services/2006/messages/FindFolder"" } } 

的var_dump($结果)

NULL 

更新#2
可以肯定的是,我在生产服务器上测试了cURL,它可以工作。我也注意到从测试服务器和生产服务器中的var_dump略有差别:

从测试服务器中的var_dump($客户端)的相关部分:

["user:protected"] 

中的var_dump有关部分($客户端)从生产服务器:

["user":protected] 

引号不在同一个地方。这是相关的,并导致查询不连接,因此没有数据被返回?如果是这样,我该如何解决这个问题?

回答

0

那么最后我想我已经在PHP 5.3.3或与Exchange与PHP 5.3说到SOAP追溯到这一个错误。3

我最好的猜测是,在原始文章的更新2中提到的受保护变量的措辞有一个错误。

相关运行PHP 5.1.1服务器var_dump($client)和另一5.2.17:

["user:protected"] 

相关var_dump($client)从运行PHP 5.3.3服务器:

["user":protected] 

所以I'm将有我想更改为一个老版本的PHP托管服务提供商。