Search code examples
phpnullexchangewebservicesphp-ews

php-ews class library always returns null


I am trying to make SOAP calls to our Exchange server using the classes I found here:

http://code.google.com/p/php-ews/

I have coded up a few examples, starting with the basic example as below and no matter what I try and do this always returns null.

$ews = new ExchangeWebServices('exchange.example.com', 'user', 'password');

$request = new EWSType_FindFolderType();
$request->Traversal = EWSType_FolderQueryTraversalType::SHALLOW;
$request->FolderShape = new EWSType_FolderResponseShapeType();
$request->FolderShape->BaseShape = EWSType_DefaultShapeNamesType::ALL_PROPERTIES;

$request->IndexedPageFolderView = new EWSType_IndexedPageViewType();
$request->IndexedPageFolderView->BasePoint = 'Beginning';
$request->IndexedPageFolderView->Offset = 0;

$request->ParentFolderIds = new EWSType_NonEmptyArrayOfBaseFolderIdsType();
$request->ParentFolderIds->DistinguishedFolderId = new EWSType_DistinguishedFolderIdType();
$request->ParentFolderIds->DistinguishedFolderId->Id = EWSType_DistinguishedFolderIdNameType::INBOX;

$response = $ews->FindFolder($request);
var_dump($response);

Has anyone else encountered this error, or can maybe shed some light on it for me?


Solution

  • Your request looks fine, it should work. Did you set up services.wsdl with your EWS server address? (see http://ewswrapper.lafiel.net/basic-info/working-with-ewswrapper/ for some more info)

    Try looking at the actual call before it is send and the response before it is interpreted. To do so in NTMLSoapClinet.php print $request at the top of __doRequest() function and end script execution (ie. die()) and then try printing $response befor it is returned in __doRequest() function and end script execution. This should give you some more insight on what's going on.