使用ews订阅推送通知

时间:2016-06-14 10:44:22

标签: soap exchangewebservices outlook-calendar

我尝试使用ews soap request订阅日历事件的推送通知。但不幸的是它失败了

错误:请求模式验证失败:无法找到元素的架构信息'订阅'。

我按照链接: https://msdn.microsoft.com/en-us/library/office/aa566188%28v=exchg.150%29.aspx#sectionSection3

您能否为该资源或任何资源提供任何解决方案。

我的EWS肥皂请求:

`     

</t:RequestServerVersion><t:TimeZoneContext><t:TimeZoneDefinition Name="UTC" Id="UTC"></t:TimeZoneDefinition></t:TimeZoneContext>
<t:ExchangeImpersonation>
<t:ConnectingSID>
    <t:PrimarySmtpAddress>test email address</t:PrimarySmtpAddress>
</t:ConnectingSID>
</t:ExchangeImpersonation>

</soap:Header>

  <soap:Body>
<Subscribe xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
           xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <PushSubscriptionRequest xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
    <FolderIds xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
      <DistinguishedFolderId Id="calendar" />
    </FolderIds>
    <EventTypes xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
      <EventType>CreatedEvent</EventType>
      <EventType>DeletedEvent</EventType>
      <EventType>ModifiedEvent</EventType>
    </EventTypes>
    <StatusFrequency xmlns="http://schemas.microsoft.com/exchange/services/2006/types">1</StatusFrequency>
    <URL xmlns="http://schemas.microsoft.com/exchange/services/2006/types">My own website url</URL>
  </PushSubscriptionRequest>
</Subscribe>

`

回复

`<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
        <s:Fault>
            <faultcode xmlns:a="http://schemas.microsoft.com/exchange/services/2006/types">a:ErrorSchemaValidation</faultcode>
            <faultstring xml:lang="en-US">The request failed schema validation: Could not find schema information for the element 'Subscribe'.</faultstring>
            <detail>
                <e:ResponseCode xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">ErrorSchemaValidation</e:ResponseCode>
                <e:Message xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">The request failed schema validation.</e:Message>
                <t:MessageXml xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
                    <t:LineNumber>17</t:LineNumber>
                    <t:LinePosition>6</t:LinePosition>
                    <t:Violation>Could not find schema information for the element 'Subscribe'.</t:Violation>
                </t:MessageXml>
            </detail>
        </s:Fault>
    </s:Body>
</s:Envelope>`

1 个答案:

答案 0 :(得分:0)

您缺少Subscribe标记的名称空间。像这样的舒缓:

<m:Subscribe xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">