Microsoft.Protocols.TestSuites.MS_OXCMAPIHTTP.MS_OXCMAPIHTTPAdapter.NotificationWait C# (CSharp) Method

NotificationWait() public method

This method is used by the client to request that the server notify the client when a processing request that takes an extended amount of time completes.
public NotificationWait ( NotificationWaitRequestBody notificationWaitRequestBody, WebHeaderCollection &httpHeaders, MailboxResponseBodyBase &responseBody, List &metatags, string>.Dictionary &additionalHeader ) : uint
notificationWaitRequestBody NotificationWaitRequestBody The request body of the NotificationWait request type.
httpHeaders System.Net.WebHeaderCollection The request and response header of the NotificationWait request type.
responseBody Microsoft.Protocols.TestSuites.Common.MailboxResponseBodyBase The response body of the NotificationWait request type.
metatags List The meta tags of the NotificationWait request type.
additionalHeader string>.Dictionary The additional headers in the Notification request type response.
return uint
        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;
        }
MS_OXCMAPIHTTPAdapter