public uint NotificationWait(NotificationWaitRequestBody notificationWaitRequestBody, ref WebHeaderCollection httpHeaders, out MailboxResponseBodyBase responseBody, out List<string> metatags, out Dictionary<string, string> additionalHeader)
{
responseBody = null;
byte[] rawBuffer;
// Send the NotificationWait HTTP request and get the response.
HttpWebResponse response = this.SendMAPIHttpRequest(this.userName, this.password, notificationWaitRequestBody, ServerEndpoint.MailboxServerEndpoint, AdapterHelper.SessionContextCookies, httpHeaders, out rawBuffer);
httpHeaders = response.Headers;
uint responseCode = AdapterHelper.GetFinalResponseCode(response.Headers["X-ResponseCode"]);
// Read the HTTP response buffer and parse the response to correct format.
CommonResponse commonResponse = CommonResponse.ParseCommonResponse(rawBuffer);
metatags = commonResponse.MetaTags;
additionalHeader = commonResponse.AdditionalHeaders;
if (responseCode == 0)
{
Site.Assert.IsNotNull(commonResponse.ResponseBodyRawData, "The response body should contains data.");
uint statusCode = BitConverter.ToUInt32(commonResponse.ResponseBodyRawData, 0);
if (statusCode == 0)
{
// Send the NotificationWait request succeeded when the StatusCode field equals zero.
NotificationWaitSuccessResponseBody responseSuccess = NotificationWaitSuccessResponseBody.Parse(commonResponse.ResponseBodyRawData);
responseBody = responseSuccess;
this.VerifyNotificationWaitSuccessResponseBody(responseSuccess);
}
this.VerifyHTTPS(response);
this.VerifyAuthentication(response);
this.VerifyAutoDiscover(response.StatusCode, ServerEndpoint.MailboxServerEndpoint);
this.VerifyHTTPHeaders(response.Headers);
this.VerifyAdditionalHeaders(commonResponse.AdditionalHeaders);
this.VerifyRequestTypesForMailboxServerEndpoint(response.Headers, commonResponse);
this.VerifyResponseMetaTags(commonResponse.MetaTags);
this.VerifyNotificationWaitRequestType(response.Headers);
}
this.VerifyContentTypeHeader(response.Headers);
this.VerifyRespondingToAllRequestTypeRequests(response, commonResponse, responseCode);
response.GetResponseStream().Close();
return responseCode;
}