ios - EWS GetStreamingEvents. Response is received only by timeout -


in ios app i'm trying streaming events ews following this manual. first subscribe notifications, receive subscription id , perform getstreamingevents request. subscription process successful, getting streaming events not. receive response timeout. yes, contain notifications, no problems expect receive response once event has occurred not when request time up.

so launched charles , examined traffic of mac mail app. can see receives 1 response right after making getstreamingevents request , receives responses every time event has occurred expected. made xml mac mail app's still no luck.

this subscribe xml:

<?xml version="1.0" encoding="utf-8"?> <soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"> <soap:header>   <t:requestedserverversion version="exchange2010_sp2" /> </soap:header> <soap:body>   <m:subscribe xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">      <m:streamingsubscriptionrequest subscribetoallfolders="true">         <t:eventtypes>            <t:eventtype>copiedevent</t:eventtype>            <t:eventtype>createdevent</t:eventtype>            <t:eventtype>deletedevent</t:eventtype>            <t:eventtype>modifiedevent</t:eventtype>            <t:eventtype>movedevent</t:eventtype>            <t:eventtype>newmailevent</t:eventtype>            <t:eventtype>freebusychangedevent</t:eventtype>         </t:eventtypes>      </m:streamingsubscriptionrequest>   </m:subscribe>   </soap:body> </soap:envelope> 

and getstreamingevents xml:

<?xml version="1.0" encoding="utf-8"?> <soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"> <soap:header>   <t:requestserverversion version="exchange2010_sp2" /> </soap:header> <soap:body>   <m:getstreamingevents xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">      <m:subscriptionids>         <t:subscriptionid>jwbkyjvwcja2bwixndy0lmv1cnbyzda2lnbyb2qub3v0bg9vay5jb20qaaaaf9r7tbxj+u+uapguz4xfytkba+ad1dqieaaaamicip/mqqjojzx9aog45fk=</t:subscriptionid>      </m:subscriptionids>      <m:connectiontimeout>30</m:connectiontimeout>   </m:getstreamingevents>   </soap:body>   </soap:envelope> 

any ideas, guys?

update:

this how build subscription:

bcstring subscriberequestmessage::buildsoaprequest() const { xml_document<> doc; xml_node<>* decl = doc.allocate_node(node_declaration); decl->append_attribute(doc.allocate_attribute("version", "1.0")); decl->append_attribute(doc.allocate_attribute("encoding", "utf-8")); doc.append_node(decl);  // envelope xml_node<>* envelope = doc.allocate_node(node_element, "soap:envelope"); envelope->append_attribute(doc.allocate_attribute("xmlns:soap", "http://schemas.xmlsoap.org/soap/envelope/")); envelope->append_attribute(doc.allocate_attribute("xmlns:t", "http://schemas.microsoft.com/exchange/services/2006/types"));  doc.append_node(envelope); {     // header     xml_node<>* header = doc.allocate_node(node_element, "soap:header");     {         xml_node<>* reqserverversion = doc.allocate_node(node_element, "t:requestedserverversion");         xml_attribute<>* serverversionattribute = doc.allocate_attribute("version", m_requestedserverversion.c_str());         reqserverversion->append_attribute(serverversionattribute);         header->append_node(reqserverversion);     }     envelope->append_node(header);      // body     xml_node<>* body = doc.allocate_node(node_element, "soap:body");     {         xml_node<>* subscribe = doc.allocate_node(node_element, "m:subscribe");         {             subscribe->append_attribute(doc.allocate_attribute("xmlns:m", "http://schemas.microsoft.com/exchange/services/2006/messages"));              xml_node<>* streamingsubscriptionrequest = doc.allocate_node(node_element, "m:streamingsubscriptionrequest");             {                  if (m_folderids.size() > 0)                 {                     xml_node<>* folderids = doc.allocate_node(node_element, "t:folderids");                     {                         (const bcstring& folderid : m_folderids)                         {                             xml_node<>* folderidnode = doc.allocate_node(node_element, "t:folderid");                             folderidnode->append_attribute(doc.allocate_attribute("id", folderid.c_str()));                             folderids->append_node(folderidnode);                         }                     }                     streamingsubscriptionrequest->append_node(folderids);                 }                 else                 {                     xml_attribute<>* subscribetoall = doc.allocate_attribute("subscribetoallfolders", "true");                     streamingsubscriptionrequest->append_attribute(subscribetoall);                 }                 xml_node<>* eventtypes = doc.allocate_node(node_element, "t:eventtypes");                 {                     (const bcstring& eventtype : m_eventtypes)                     {                         xml_node<>* eventtypenode      = doc.allocate_node(node_element, "t:eventtype");                         xml_node<>* eventtypevaluenode = doc.allocate_node(node_data, "", eventtype.c_str());                         eventtypenode->append_node(eventtypevaluenode);                         eventtypes->append_node(eventtypenode);                     }                 }                 streamingsubscriptionrequest->append_node(eventtypes);             }             subscribe->append_node(streamingsubscriptionrequest);         }          body->append_node(subscribe);     }     envelope->append_node(body); }  bcstring retval; print(std::back_inserter(retval), doc, print_no_indenting);  return retval; } 

and how build streaming xml:

bcstring getstreamingeventsrequest::buildsoaprequest() const { xml_document<> doc; xml_node<>* decl = doc.allocate_node(node_declaration); decl->append_attribute(doc.allocate_attribute("version", "1.0")); decl->append_attribute(doc.allocate_attribute("encoding", "utf-8")); doc.append_node(decl);  // envelope xml_node<>* envelope = doc.allocate_node(node_element, "soap:envelope"); envelope->append_attribute(doc.allocate_attribute("xmlns:soap", "http://schemas.xmlsoap.org/soap/envelope/")); envelope->append_attribute(doc.allocate_attribute("xmlns:t", "http://schemas.microsoft.com/exchange/services/2006/types"));  doc.append_node(envelope); {     // header     xml_node<>* header = doc.allocate_node(node_element, "soap:header");     {         xml_node<>* reqserverversion = doc.allocate_node(node_element, "t:requestserverversion");         xml_attribute<>* serverversionattribute = doc.allocate_attribute("version", m_requestedserverversion.c_str());         reqserverversion->append_attribute(serverversionattribute);         header->append_node(reqserverversion);     }     envelope->append_node(header);      // body     xml_node<>* body = doc.allocate_node(node_element, "soap:body");     {         xml_node<>* getstreamingevents = doc.allocate_node(node_element, "m:getstreamingevents");         {             getstreamingevents->append_attribute(doc.allocate_attribute("xmlns:m", "http://schemas.microsoft.com/exchange/services/2006/messages"));              xml_node<>* subscriptionids = doc.allocate_node(node_element, "m:subscriptionids");             {                 (const bcstring& subscriptionid : m_subscriptionids)                 {                     xml_node<>* subscriptionidnode  = doc.allocate_node(node_element, "t:subscriptionid");                     xml_node<>* subscriptionidvalue = doc.allocate_node(node_data, "", subscriptionid.c_str());                     subscriptionidnode->append_node(subscriptionidvalue);                     subscriptionids->append_node(subscriptionidnode);                 }             }              getstreamingevents->append_node(subscriptionids);              xml_node<>* connectiontimeout      = doc.allocate_node(node_element, "m:connectiontimeout");             bcstring connectiontimeoutstring   = std::to_string(m_connectiontimeout);             xml_node<>* connectiontimeoutvalue = doc.allocate_node(node_data, "", connectiontimeoutstring.c_str());             connectiontimeout->append_node(connectiontimeoutvalue);             getstreamingevents->append_node(connectiontimeout);         }          body->append_node(getstreamingevents);     }     envelope->append_node(body); }  bcstring retval; print(std::back_inserter(retval), doc, print_no_indenting);  return retval; } 

update:

this xml of mac mail app see via charles: subscription:

<?xml version="1.0" encoding="utf-8"?> <soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"> <soap:header>   <t:requestserverversion version="exchange2010_sp2" /> </soap:header> <soap:body>   <m:subscribe xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">      <m:streamingsubscriptionrequest subscribetoallfolders="true">         <t:eventtypes>            <t:eventtype>copiedevent</t:eventtype>            <t:eventtype>createdevent</t:eventtype>            <t:eventtype>deletedevent</t:eventtype>            <t:eventtype>modifiedevent</t:eventtype>            <t:eventtype>movedevent</t:eventtype>            <t:eventtype>newmailevent</t:eventtype>            <t:eventtype>freebusychangedevent</t:eventtype>         </t:eventtypes>      </m:streamingsubscriptionrequest>   </m:subscribe>   </soap:body>   </soap:envelope> 

and streaming:

<?xml version="1.0" encoding="utf-8"?> <soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"> <soap:header>   <t:requestserverversion version="exchange2010_sp2" /> </soap:header> <soap:body>   <m:getstreamingevents xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">      <m:subscriptionids>         <t:subscriptionid>jwbkyjvwcja2bwixndy0lmv1cnbyzda2lnbyb2qub3v0bg9vay5jb20qaaaadv7qps0xbu6v0mcxt2svfhyoyocq1dqieaaaamicip/mqqjojzx9aog45fk=</t:subscriptionid>      </m:subscriptionids>      <m:connectiontimeout>30</m:connectiontimeout>   </m:getstreamingevents>   </soap:body>   </soap:envelope> 

and response ews arriving upon timeout , containing notification new mail:

<envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"> <soap11:header     xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/">     <serverversioninfo         xmlns:xsd="http://www.w3.org/2001/xmlschema"         xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" majorversion="15" minorversion="1" majorbuildnumber="1282" minorbuildnumber="22" version="v2017_04_14"         xmlns="http://schemas.microsoft.com/exchange/services/2006/types" />     </soap11:header>     <soap11:body         xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/">         <m:getstreamingeventsresponse             xmlns:xsd="http://www.w3.org/2001/xmlschema"             xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"             xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"             xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">             <m:responsemessages>                 <m:getstreamingeventsresponsemessage responseclass="success">                     <m:responsecode>noerror</m:responsecode>                     <m:connectionstatus>ok</m:connectionstatus>                 </m:getstreamingeventsresponsemessage>             </m:responsemessages>         </m:getstreamingeventsresponse>     </soap11:body> </envelope> <envelope     xmlns="http://schemas.xmlsoap.org/soap/envelope/">     <soap11:header         xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/">         <serverversioninfo             xmlns:xsd="http://www.w3.org/2001/xmlschema"             xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" majorversion="15" minorversion="1" majorbuildnumber="1282" minorbuildnumber="22" version="v2017_04_14"             xmlns="http://schemas.microsoft.com/exchange/services/2006/types" />         </soap11:header>         <soap11:body             xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/">             <m:getstreamingeventsresponse                 xmlns:xsd="http://www.w3.org/2001/xmlschema"                 xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"                 xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"                 xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">                 <m:responsemessages>                     <m:getstreamingeventsresponsemessage responseclass="success">                         <m:responsecode>noerror</m:responsecode>                         <m:notifications>                             <m:notification>                                 <t:subscriptionid>jwbkyjvwcja2bwixndy0lmv1cnbyzda2lnbyb2qub3v0bg9vay5jb20qaaaa4mbqzqhzf0aa35z5r1uevpztjfmw1dqieaaaamicip/mqqjojzx9aog45fk=</t:subscriptionid>                                 <t:createdevent>                                     <t:timestamp>2017-07-28t12:06:04z</t:timestamp>                                     <t:itemid id="aamkagzmmja4mmm4ltqyztytngvhmi04zjnjltdkmdi4odm4ztq1oqbgaaaaaadka2su6/exrrsmoefdscl3bwbeito0krayrbrmlsc3jnegaaaaaaemaabeito0krayrbrmlsc3jnegaaadpaosaaa=" changekey="cqaaaa==" />                                     <t:parentfolderid id="aamkagzmmja4mmm4ltqyztytngvhmi04zjnjltdkmdi4odm4ztq1oqauaaaaaadka2su6/exrrsmoefdscl3aqbeito0krayrbrmlsc3jnegaaaaaaemaaa=" changekey="aqaaaa==" />                                 </t:createdevent>                                 <t:newmailevent>                                     <t:timestamp>2017-07-28t12:06:04z</t:timestamp>                                     <t:itemid id="aamkagzmmja4mmm4ltqyztytngvhmi04zjnjltdkmdi4odm4ztq1oqbgaaaaaadka2su6/exrrsmoefdscl3bwbeito0krayrbrmlsc3jnegaaaaaaemaabeito0krayrbrmlsc3jnegaaadpaosaaa=" changekey="cqaaaa==" />                                     <t:parentfolderid id="aamkagzmmja4mmm4ltqyztytngvhmi04zjnjltdkmdi4odm4ztq1oqauaaaaaadka2su6/exrrsmoefdscl3aqbeito0krayrbrmlsc3jnegaaaaaaemaaa=" changekey="aqaaaa==" />                                 </t:newmailevent>                                 <t:modifiedevent>                                     <t:timestamp>2017-07-28t12:06:04z</t:timestamp>                                     <t:folderid id="aamkagzmmja4mmm4ltqyztytngvhmi04zjnjltdkmdi4odm4ztq1oqauaaaaaadka2su6/exrrsmoefdscl3aqbeito0krayrbrmlsc3jnegaaaaaaemaaa=" changekey="aqaaaa==" />                                     <t:parentfolderid id="aamkagzmmja4mmm4ltqyztytngvhmi04zjnjltdkmdi4odm4ztq1oqauaaaaaadka2su6/exrrsmoefdscl3aqbeito0krayrbrmlsc3jnegaaaaaaeiaaa=" changekey="aqaaaa==" />                                     <t:unreadcount>1</t:unreadcount>                                 </t:modifiedevent>                             </m:notification>                         </m:notifications>                     </m:getstreamingeventsresponsemessage>                 </m:responsemessages>             </m:getstreamingeventsresponse>         </soap11:body>     </envelope>     <envelope         xmlns="http://schemas.xmlsoap.org/soap/envelope/">         <soap11:header             xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/">             <serverversioninfo                 xmlns:xsd="http://www.w3.org/2001/xmlschema"                 xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" majorversion="15" minorversion="1" majorbuildnumber="1282" minorbuildnumber="22" version="v2017_04_14"                 xmlns="http://schemas.microsoft.com/exchange/services/2006/types" />             </soap11:header>             <soap11:body                 xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/">                 <m:getstreamingeventsresponse                     xmlns:xsd="http://www.w3.org/2001/xmlschema"                     xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"                     xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"                     xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">                     <m:responsemessages>                         <m:getstreamingeventsresponsemessage responseclass="success">                             <m:responsecode>noerror</m:responsecode>                             <m:connectionstatus>ok</m:connectionstatus>                         </m:getstreamingeventsresponsemessage>                     </m:responsemessages>                 </m:getstreamingeventsresponse>             </soap11:body>         </envelope>         <envelope             xmlns="http://schemas.xmlsoap.org/soap/envelope/">             <soap11:header                 xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/">                 <serverversioninfo                     xmlns:xsd="http://www.w3.org/2001/xmlschema"                     xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" majorversion="15" minorversion="1" majorbuildnumber="1282" minorbuildnumber="22" version="v2017_04_14"                     xmlns="http://schemas.microsoft.com/exchange/services/2006/types" />                 </soap11:header>                 <soap11:body                     xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/">                     <m:getstreamingeventsresponse                         xmlns:xsd="http://www.w3.org/2001/xmlschema"                         xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"                         xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"                         xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">                         <m:responsemessages>                             <m:getstreamingeventsresponsemessage responseclass="success">                                 <m:responsecode>noerror</m:responsecode>                                 <m:connectionstatus>ok</m:connectionstatus>                             </m:getstreamingeventsresponsemessage>                         </m:responsemessages>                     </m:getstreamingeventsresponse>                 </soap11:body>             </envelope>             <envelope                 xmlns="http://schemas.xmlsoap.org/soap/envelope/">                 <soap11:header                     xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/">                     <serverversioninfo                         xmlns:xsd="http://www.w3.org/2001/xmlschema"                         xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" majorversion="15" minorversion="1" majorbuildnumber="1282" minorbuildnumber="22" version="v2017_04_14"                         xmlns="http://schemas.microsoft.com/exchange/services/2006/types" />                     </soap11:header>                     <soap11:body                         xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/">                         <m:getstreamingeventsresponse                             xmlns:xsd="http://www.w3.org/2001/xmlschema"                             xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"                             xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"                             xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">                             <m:responsemessages>                                 <m:getstreamingeventsresponsemessage responseclass="success">                                     <m:responsecode>noerror</m:responsecode>                                     <m:notifications>                                         <m:notification>                                             <t:subscriptionid>jwbkyjvwcja2bwixndy0lmv1cnbyzda2lnbyb2qub3v0bg9vay5jb20qaaaa4mbqzqhzf0aa35z5r1uevpztjfmw1dqieaaaamicip/mqqjojzx9aog45fk=</t:subscriptionid>                                             <t:modifiedevent>                                                 <t:timestamp>2017-07-28t12:07:39z</t:timestamp>                                                 <t:itemid id="aamkagzmmja4mmm4ltqyztytngvhmi04zjnjltdkmdi4odm4ztq1oqbgaaaaaadka2su6/exrrsmoefdscl3bwbeito0krayrbrmlsc3jnegaaaaaaemaabeito0krayrbrmlsc3jnegaaadpaosaaa=" changekey="cqaaaa==" />                                                 <t:parentfolderid id="aamkagzmmja4mmm4ltqyztytngvhmi04zjnjltdkmdi4odm4ztq1oqauaaaaaadka2su6/exrrsmoefdscl3aqbeito0krayrbrmlsc3jnegaaaaaaemaaa=" changekey="aqaaaa==" />                                             </t:modifiedevent>                                             <t:modifiedevent>                                                 <t:timestamp>2017-07-28t12:07:39z</t:timestamp>                                                 <t:folderid id="aamkagzmmja4mmm4ltqyztytngvhmi04zjnjltdkmdi4odm4ztq1oqauaaaaaadka2su6/exrrsmoefdscl3aqbeito0krayrbrmlsc3jnegaaaaaaemaaa=" changekey="aqaaaa==" />                                                 <t:parentfolderid id="aamkagzmmja4mmm4ltqyztytngvhmi04zjnjltdkmdi4odm4ztq1oqauaaaaaadka2su6/exrrsmoefdscl3aqbeito0krayrbrmlsc3jnegaaaaaaeiaaa=" changekey="aqaaaa==" />                                                 <t:unreadcount>0</t:unreadcount>                                             </t:modifiedevent>                                         </m:notification>                                     </m:notifications>                                 </m:getstreamingeventsresponsemessage>                             </m:responsemessages>                         </m:getstreamingeventsresponse>                     </soap11:body>                 </envelope>                 <envelope                     xmlns="http://schemas.xmlsoap.org/soap/envelope/">                     <soap11:header                         xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/">                         <serverversioninfo                             xmlns:xsd="http://www.w3.org/2001/xmlschema"                             xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" majorversion="15" minorversion="1" majorbuildnumber="1282" minorbuildnumber="22" version="v2017_04_14"                             xmlns="http://schemas.microsoft.com/exchange/services/2006/types" />                         </soap11:header>                         <soap11:body                             xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/">                             <m:getstreamingeventsresponse                                 xmlns:xsd="http://www.w3.org/2001/xmlschema"                                 xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"                                 xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"                                 xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">                                 <m:responsemessages>                                     <m:getstreamingeventsresponsemessage responseclass="success">                                         <m:responsecode>noerror</m:responsecode>                                         <m:connectionstatus>closed</m:connectionstatus>                                     </m:getstreamingeventsresponsemessage>                                 </m:responsemessages>                             </m:getstreamingeventsresponse>                         </soap11:body>                     </envelope> 

i ran problem once, don't know if same you. using ews on http chunked transfer encoding , received responses @ timeout. turned out terminating 0 chunk sent @ timeout, not after each response, therefore waiting more data until timeout.

note not bad have low timeout since might want use multiple subscriptions in single getevents request , can't add or remove subscriptions running getevents request.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -