1

我正在订阅日历事件的 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,但它未能收到通知!

有人可以帮忙吗?我究竟做错了什么?如何检查交易所是否正在发送通知?我的交易所是否有可能禁用了通知?

4

1 回答 1

1

通常,成功订阅后未收到通知是防火墙问题或路由/DNS 问题。我认为您没有共享您设置的内容,$url但如果 URL 中有端口,则必须在防火墙上打开它,如果其中有主机名,则该名称必须可以Exchange 服务器PING .

于 2018-08-06T16:30:27.197 回答