I am subscribing to EWS push notifications for calendar events and to log notifications.
I am using PHP-EWS: jamesiarmes/php-ews and Symfony 4.1
To subscribe I'm using this code:
$ews = new Client($this->host, $this->username, $this->password, $this->version);
$ews->setCurlOptions($this->curlOptions);
$eventTypes = new NonEmptyArrayOfNotificationEventTypesType();
$eventTypes->EventType[] = NotificationEventTypeType::CREATED_EVENT;
$eventTypes->EventType[] = NotificationEventTypeType::MODIFIED_EVENT;
$eventTypes->EventType[] = NotificationEventTypeType::DELETED_EVENT;
$eventTypes->EventType[] = NotificationEventTypeType::COPIED_EVENT;
$eventTypes->EventType[] = NotificationEventTypeType::MOVED_EVENT;
$folderIDs = new NonEmptyArrayOfBaseFolderIdsType();
$folderIDs->DistinguishedFolderId = new DistinguishedFolderIdType();
$folderIDs->DistinguishedFolderId->Id = DistinguishedFolderIdNameType::CALENDAR;
$pushSubscription = new PushSubscriptionRequestType();
$pushSubscription->FolderIds = $folderIDs;
$pushSubscription->EventTypes = $eventTypes;
$pushSubscription->StatusFrequency = 1;
$pushSubscription->URL = $url;
$subscribe_request = new SubscribeType();
$subscribe_request->PushSubscriptionRequest = $pushSubscription;
$response = $ews->Subscribe($subscribe_request);
return $response;
My WSDL looks like this, I'm using zend soap's autodiscovery function to auto generate this:
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://192.168.11.7/app_dev.php/api/soap/server"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" name="ExchangeSoapService"
targetNamespace="http://192.168.11.7/app_dev.php/api/soap/server">
<types>
<xsd:schema targetNamespace="http://192.168.11.7/app_dev.php/api/soap/server"/>
</types>
<portType name="ExchangeSoapServicePort">
<operation name="SendNotification">
<documentation>Check soap service, display name when called</documentation>
<input message="tns:SendNotificationIn"/>
<output message="tns:SendNotificationOut"/>
</operation>
</portType>
<binding name="ExchangeSoapServiceBinding" type="tns:ExchangeSoapServicePort">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="SendNotification">
<soap:operation soapAction="http://192.168.11.7/app_dev.php/api/soap/server#SendNotification"/>
<input>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://192.168.11.7/app_dev.php/api/soap/server"/>
</input>
<output>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://192.168.11.7/app_dev.php/api/soap/server"/>
</output>
</operation>
</binding>
<service name="ExchangeSoapServiceService">
<port name="ExchangeSoapServicePort" binding="tns:ExchangeSoapServiceBinding">
<soap:address location="http://192.168.11.7/app_dev.php/api/soap/server"/>
</port>
</service>
<message name="SendNotificationIn">
<part name="arg" type="xsd:anyType"/>
</message>
<message name="SendNotificationOut">
<part name="return" type="xsd:anyType"/>
</message>
After some figuring out I obtain a success code, that includes a SubscriptionId and Watermark, but it fails to get the notification!
Can someone help with this? What am I doing wrong? How can I check if exchange is sending notifications? Is it possible that my exchange has notifications disabled?