I've never tried this before but I'm trying to use PHP to get data about an exchange account (for example the number of emails in the Inbox and the amount of unread email in the inbox). Just for the record, the PHP server is on a different domain than the exchange server.
My PHP server is running on:
- System: Linux
- PHP Version 5.3.3
- cURL Information 7.19.7
- cURL NTLM Yes
- Soap Client and server enabled
The Excahnge is running:
- Version 14.1 or Exchange 2010 SP1
I have tried 3 PHP libraries that all return a very similar error. The Heartspring Exchange Web Services for PHP, PHP-EWS and EWSWrapper libraries.
As all 3 libraries require, I downloaded the three files from the exchange server and placed them in the appropriate location on the PHP server web directory:
- Services.wsdl (used both uppercase and lovercase first letter)
- messages.xsd
- types.xsd
I also added the ExchangeServiceBinding
to Services.wsdl
and pointed the soap:address location
to the exchange servers Exchange.asmx
(I tested the link and it´s correct).
I get a very similar error message with all 3 libraries, here is the full error from EWSWrapper:
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR:
Parsing Schema: can't import schema from
'/var/www/vhosts/domain.com/EWSWrapper/wsdl/types.xsd'in
/var/www/vhosts/domain.com/EWSWrapper/NTLMSoapClient/Exchange.php:52
Stack trace: #0
/var/www/vhosts/domain.com/EWSWrapper/NTLMSoapClient/Exchange.php(52):
SoapClient->SoapClient('/var/www/vhosts...', Array)
#1
/var/www/vhosts/domain.com/EWSWrapper/ExchangeWebServices.php(483):
NTLMSoapClient_Exchange->__construct('/var/www/vhosts...', Array)
#2
/var/www/vhosts/domain.com/EWSWrapper/ExchangeWebServices.php(235):
ExchangeWebServices->initializeSoapClient()
#3
/var/www/vhosts/domain.com/EWSWrapper/EWSWrapper.php(529):
ExchangeWebServices->FindFolder(Object(EWSType_FindFolderType))
#4
/var/www/vhosts/domain.com/EWSWrapper/test in
/var/www/vhosts/domain.com/EWSWrapper/NTLMSoapClient/Exchange.php on line 52
The Exchange.php:52 points to:
parent::__construct($wsdl, $options);
The ExchangeWebServices.php(483) points to:
protected function initializeSoapClient() {
return new NTLMSoapClient_Exchange(
dirname(__FILE__).'/wsdl/services.wsdl',
array(
'user' => $this->username,
'password' => $this->password,
'location' => 'https://'.$this->server.'/EWS/Exchange.asmx',
)); // end return
} // end function initializeSoapClient()
There I tried having the server path (/var/www/...) and also the web url path (http://domain.com/...) to the services.wsdl and also the server location, that changes nothing exept for the urls in the error code above.
The ExcahngeWebServices.php(235) point to:
public function FindFolder($request) {
$request->getAsSOAP();
return $this->initializeSoapClient()->{__FUNCTION__}($request);
} // end function FindFolder()
It´s seems that there might be an issue with the $request, as the next trace EWSWrapper.php(529) point to:
// make the actual call
$response = $this->ews->FindFolder($request);
return $response;
Any help would be appreciated as an extensive Google and Stack Exchange search has not helped. I would think that the path to the types.xsd
is wrong or something wrong with the $request
.
__construct()
? – hek2mglvar_dump(is_readable('dirname(__FILE__).'/wsdl/types.xsd'));
? (from relevant content) – hek2mgl