Я пытаюсь передать уведомление с сервера обмена на мое приложение 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="
}
Per документации Следующий шаг должен отправлено получить strsaming событий запрос с подпиской Код:
{
"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 й статус 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>
Не могли бы вы посоветовать это.
Update:
Новый запрос с исправлениями:
{
"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>
Не могли бы вы, пожалуйста, посмотрите на мой редактирования. Спасибо. – eomeroff
Его проблема с типом данных. Мне кажется, вам нужно указать время соединения в кавычках, например «ConnectionTimeout»: «30», учитывая другие примеры, в которых используются целые числа. –
Не могли бы вы взглянуть на этот мой вопрос http://stackoverflow.com/questions/35863589/meteor-js-push-notifications-to-exchange-server, который продолжает рассказывать об этом. Спасибо. – eomeroff