我正在为日历事件订阅EWS推送通知并记录通知。
我正在使用PHP-EWS:jamesiarmes / php-ews和Symfony 4.1
要订阅,我正在使用以下代码:
$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;
我的WSDL如下所示,我正在使用zend soap的自动发现功能来自动生成以下内容:
<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>
经过一番摸索,我获得了一个成功代码,其中包括SubscriptionId和Watermark,但未能收到通知!
有人可以帮忙吗?我究竟做错了什么? 如何检查交易所是否正在发送通知? 我的交易所是否可能禁用了通知?
答案 0 :(得分:1)
通常,在成功订阅后没有收到通知是防火墙问题或路由/ DNS问题。我认为您没有共享$url
中设置的内容,但是如果URL中有端口,则必须在防火墙上将其打开,并且如果其中包含主机名,则必须使用来自Exchange服务器的