2016-03-07 37 views
0

我试图将交换服务器的通知流式传输到我的meterojs应用程序。对Exchange服务器不起作用的流通知订阅

我发送以下SOAP消息流订阅请求:

{ 
    "body":{ 
     "m:Subscribe":{ 
     "m:StreamingSubscriptionRequest":{ 
      "t:FolderIds":{ 
       "t:DistinguishedFolderId":{ 
        "attributes":[ 
        { 
         "Id":"calendar" 
        } 
        ] 
       } 
      }, 
      "t:EventTypes":{ 
       "t:EventType":"CreatedEvent" 
      } 
     } 
     } 
    }, 
    "headers":{ 
     "Authorization":"Basic YW5kZXJzLmthcmxzc29uQGNlcnR1c2ludGVybmF0aW9uYWwub25taWNyb3NvZnQuY29tOmxpaXNzc29vb280MzIh" 
    }, 
    "additionalNamespaces":[ 
     "xmlns:m=\"http://schemas.microsoft.com/exchange/services/2006/messages\"", 
     "xmlns:t=\"http://schemas.microsoft.com/exchange/services/2006/types\"" 
    ], 
    "soapHeader":"", 
    "method":"POST", 
    "url":"https://outlook.office365.com/EWS/Exchange.asmx" 
} 

我获得以下响应与订阅ID:

{ 
    "xmlns:s":"http://schemas.xmlsoap.org/soap/envelope/", 
    "MajorVersion":"15", 
    "MinorVersion":"1", 
    "MajorBuildNumber":"434", 
    "MinorBuildNumber":"14", 
    "xmlns:h":"http://schemas.microsoft.com/exchange/services/2006/types", 
    "xmlns:xsd":"http://www.w3.org/2001/XMLSchema", 
    "xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance", 
    "xmlns:m":"http://schemas.microsoft.com/exchange/services/2006/messages", 
    "xmlns:t":"http://schemas.microsoft.com/exchange/services/2006/types", 
    "ResponseClass":"Success", 
    "m:ResponseCode":"NoError", 
    "m:SubscriptionId":"JwBkYjVwcjA3bWIxMzk3LmV1cnByZDA3LnByb2Qub3V0bG9vay5jb20QAAAA/wYNryw5gEeJFs3T7NXJvglEUWvERtMIEAAAAPP2lIvBykJBqcK1FSVk+mk=" 
} 

每文档下一步是对发获得strsaming事件与订阅请求ID:

{ 
    "body":{ 
     "GetStreamingEvents":{ 
     "attributes":[ 
      { 
       "xmlns":"http://schemas.microsoft.com/exchange/services/2006/messages" 
      } 
     ], 
     "SubscriptionId":"JwBkYjVwcjA3bWIxMzk3LmV1cnByZDA3LnByb2Qub3V0bG9vay5jb20QAAAA/wYNryw5gEeJFs3T7NXJvglEUWvERtMIEAAAAPP2lIvBykJBqcK1FSVk+mk=", 
     "ConnectionTimeout":30 
     } 
    }, 
    "headers":{ 
     "Authorization":"Basic YW5kZXJzLmthcmxzc29uQGNlcnR1c2ludGVybmF0aW9uYWwub25taWNyb3NvZnQuY29tOmxpaXNzc29vb280MzIh" 
    }, 
    "additionalNamespaces":[ 
     "xmlns:m=\"http://schemas.microsoft.com/exchange/services/2006/messages\"", 
     "xmlns:t=\"http://schemas.microsoft.com/exchange/services/2006/types\"" 
    ], 
    "soapHeader":{ 
     "t:RequestServerVersion":{ 
     "attributes":[ 
      { 
       "Version":"Exchange2013" 
      } 
     ] 
     } 
    }, 
    "method":"POST", 
    "url":"https://outlook.office365.com/EWS/Exchange.asmx" 
} 

在此我得到回复wi th状态500和响应主体:

<?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: The element 'GetStreamingEvents' in namespace 'http://schemas.microsoft.com/exchange/services/2006/messages' has invalid child element 'SubscriptionId' in namespace 'http://schemas.microsoft.com/exchange/services/2006/messages'. List of possible elements expected: 'SubscriptionIds' in namespace 'http://schemas.microsoft.com/exchange/services/2006/messages'.</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>3</t:LineNumber> 
        <t:LinePosition>201</t:LinePosition> 
        <t:Violation>The element 'GetStreamingEvents' in namespace 'http://schemas.microsoft.com/exchange/services/2006/messages' has invalid child element 'SubscriptionId' in namespace 'http://schemas.microsoft.com/exchange/services/2006/messages'. List of possible elements expected: 'SubscriptionIds' in namespace 'http://schemas.microsoft.com/exchange/services/2006/messages'.</t:Violation> 
       </t:MessageXml> 
      </detail> 
     </s:Fault> 
    </s:Body> 
</s:Envelope> 

你能否就此建议。

更新:

与修正新要求:

{ 
    "body":{ 
     "m:GetStreamingEvents":{ 
     "m:SubscriptionIds":{ 
      "t:SubscriptionId":"JwBhbTRwcjA3bWIxMzk1LmV1cnByZDA3LnByb2Qub3V0bG9vay5jb20QAAAAnjsBVFou+0u0dglnKKEJ0CDsxAkYR9MIEAAAAPP2lIvBykJBqcK1FSVk+mk=" 
     }, 
     "m:ConnectionTimeout":30 
     } 
    }, 
    "headers":{ 
     "Authorization":"Basic YW5kZXJzLmthcmxzc29uQGNlcnR1c2ludGVybmF0aW9uYWwub25taWNyb3NvZnQuY29tOmxpaXNzc29vb280MzIh" 
    }, 
    "additionalNamespaces":[ 
     "xmlns:m=\"http://schemas.microsoft.com/exchange/services/2006/messages\"", 
     "xmlns:t=\"http://schemas.microsoft.com/exchange/services/2006/types\"" 
    ], 
    "soapHeader":{ 
     "t:RequestServerVersion":{ 
     "attributes":[ 
      { 
       "Version":"Exchange2013" 
      } 
     ] 
     } 
    }, 
    "method":"POST", 
    "url":"https://outlook.office365.com/EWS/Exchange.asmx" 
} 

与不同的错误新的响应:

<?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: The 'http://schemas.microsoft.com/exchange/services/2006/messages:ConnectionTimeout' element is invalid - The value 'undefined' is invalid according to its datatype 'http://schemas.microsoft.com/exchange/services/2006/types:StreamingSubscriptionConnectionTimeoutType' - The string 'undefined' is not a valid Int32 value.</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>3</t:LineNumber> 
        <t:LinePosition>361</t:LinePosition> 
        <t:Violation>The 'http://schemas.microsoft.com/exchange/services/2006/messages:ConnectionTimeout' element is invalid - The value 'undefined' is invalid according to its datatype 'http://schemas.microsoft.com/exchange/services/2006/types:StreamingSubscriptionConnectionTimeoutType' - The string 'undefined' is not a valid Int32 value.</t:Violation> 
       </t:MessageXml> 
      </detail> 
     </s:Fault> 
    </s:Body> 
</s:Envelope> 

回答

1

我不认为在线文档是正确的工作要求应该看起来像

 <?xml version="1.0" encoding="utf-8"?> 
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
     <soap:Header> 
     <t:RequestServerVersion Version="Exchange2013" /> 
     <t:ExchangeImpersonation> 
      <t:ConnectingSID> 
      <t:SmtpAddress>[email protected]</t:SmtpAddress> 
      </t:ConnectingSID> 
     </t:ExchangeImpersonation> 
     </soap:Header> 
     <soap:Body> 
     <m:GetStreamingEvents> 
      <m:SubscriptionIds> 
      <t:SubscriptionId>JwB0eTFwcjA0bWIwNzE4LmFwY3ByZDA0LnByb2Qub3V0bG9vay5jb20QAAAAhKGBpeZ5jEWJiN8rkO4xNxQ6jxrvRtMIEAAAAGhtpJbjoodMsSowkUdd9qk=</t:SubscriptionId> 
      </m:SubscriptionIds> 
      <m:ConnectionTimeout>15</m:ConnectionTimeout> 
     </m:GetStreamingEvents> 
     </soap:Body> 
    </soap:Envelope> 

所以错误你回来是有道理的,因为你错过了SubscriptionIds元素。 (不知道为什么DOCO是错误的)

干杯 格伦

+0

可否请你看看我的编辑。谢谢。 – eomeroff

+1

它是一个数据类型问题我想你需要把连接时间放在引号中,例如“ConnectionTimeout”:'30'给出了其他使用整数的例子。 –

+0

你可以请看看我的这个问题http://stackoverflow.com/questions/35863589/meteor-js-push-notifications-to-exchange-server它是继续从这一个故事。谢谢。 – eomeroff