1

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

错误:请求未通过架构验证:找不到元素“订阅”的架构信息。

我点击链接: 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>`
4

1 回答 1

0

您缺少Subscribe标签的命名空间。像这样的东西:

<m:Subscribe xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
于 2020-04-07T13:17:58.590 回答