/// <summary> /// Try to read the XML declaration. If it's not there, the server didn't return XML. /// </summary> /// <param name="reader">The reader.</param> private async System.Threading.Tasks.Task ReadXmlDeclarationAsync(EwsServiceXmlReader reader, CancellationToken token) { try { await reader.ReadAsync(XmlNodeType.XmlDeclaration, token); } catch (XmlException ex) { throw new ServiceRequestException(Strings.ServiceResponseDoesNotContainXml, ex); } catch (ServiceXmlDeserializationException ex) { throw new ServiceRequestException(Strings.ServiceResponseDoesNotContainXml, ex); } }
/// <summary> /// Read SOAP header and extract server version /// </summary> /// <param name="reader">EwsServiceXmlReader</param> private async System.Threading.Tasks.Task ReadSoapHeaderAsync(EwsServiceXmlReader reader, CancellationToken token) { await reader.ReadStartElementAsync(XmlNamespace.Soap, XmlElementNames.SOAPHeaderElementName, token); do { await reader.ReadAsync(token); // Is this the ServerVersionInfo? if (reader.IsStartElement(XmlNamespace.Types, XmlElementNames.ServerVersionInfo)) { this.Service.ServerInfo = ExchangeServerInfo.Parse(reader); } // Ignore anything else inside the SOAP header }while (!reader.IsEndElement(XmlNamespace.Soap, XmlElementNames.SOAPHeaderElementName)); }