ReadResponseWithHeaders method

Object ReadResponseWithHeaders(
  1. EwsServiceXmlReader ewsXmlReader,
  2. WebHeaderCollection? responseHeaders
)
Reads the response. The XML reader. HTTP response headers

Implementation

Object ReadResponseWithHeaders(
    EwsServiceXmlReader ewsXmlReader, WebHeaderCollection? responseHeaders) {
  Object serviceResponse;

  this.ReadPreamble(ewsXmlReader);
  ewsXmlReader.ReadStartElementWithNamespace(
      XmlNamespace.Soap, XmlElementNames.SOAPEnvelopeElementName);
  this._ReadSoapHeader(ewsXmlReader);
  ewsXmlReader.ReadStartElementWithNamespace(
      XmlNamespace.Soap, XmlElementNames.SOAPBodyElementName);

  ewsXmlReader.ReadStartElementWithNamespace(
      XmlNamespace.Messages, this.GetResponseXmlElementName());

  if (responseHeaders != null) {
    serviceResponse =
        this.ParseResponseWithHeaders(ewsXmlReader, responseHeaders);
  } else {
    serviceResponse = this.ParseResponse(ewsXmlReader);
  }

  ewsXmlReader.ReadEndElementIfNecessary(
      XmlNamespace.Messages, this.GetResponseXmlElementName());

  ewsXmlReader.ReadEndElementWithNamespace(
      XmlNamespace.Soap, XmlElementNames.SOAPBodyElementName);
  ewsXmlReader.ReadEndElementWithNamespace(
      XmlNamespace.Soap, XmlElementNames.SOAPEnvelopeElementName);
  return serviceResponse;
}