/// <summary> /// The method to send NotificationWait request to the server. /// </summary> /// <param name="requestBody">The NotificationWait request body.</param> /// <returns>Return the NotificationWait response body.</returns> public NotificationWaitSuccessResponseBody NotificationWaitCall(IRequestBody requestBody) { string requestType = "NotificationWait"; HttpWebResponse response = SendMAPIHttpRequest(this.site, this.mailStoreUrl, this.userName, this.domain, this.userPassword, requestBody, requestType, this.cookies); NotificationWaitSuccessResponseBody result = null; string responseCode = response.Headers["X-ResponseCode"]; byte[] rawBuffer = ReadHttpResponse(response); response.GetResponseStream().Close(); if (int.Parse(responseCode) == 0) { ChunkedResponse chunkedResponse = ChunkedResponse.ParseChunkedResponse(rawBuffer); NotificationWaitSuccessResponseBody responseSuccess = NotificationWaitSuccessResponseBody.Parse(chunkedResponse.ResponseBodyRawData); result = responseSuccess; } else { this.site.Assert.Fail("MAPIHTTP call failed, the error code returned from server is: {0}", responseCode); } return(result); }
/// <summary> /// Parse the NotificationWait request type success response body. /// </summary> /// <param name="rawData">The raw data which is returned by server.</param> /// <returns>A instance of NotificationWaitSuccessResponseBody class.</returns> public static NotificationWaitSuccessResponseBody Parse(byte[] rawData) { NotificationWaitSuccessResponseBody responseBody = new NotificationWaitSuccessResponseBody(); int index = 0; responseBody.StatusCode = BitConverter.ToUInt32(rawData, index); index += 4; responseBody.ErrorCode = BitConverter.ToUInt32(rawData, index); index += 4; responseBody.EventPending = BitConverter.ToUInt32(rawData, index); index += 4; responseBody.AuxiliaryBufferSize = BitConverter.ToUInt32(rawData, index); index += 4; responseBody.AuxiliaryBuffer = new byte[responseBody.AuxiliaryBufferSize]; Array.Copy(rawData, index, responseBody.AuxiliaryBuffer, 0, responseBody.AuxiliaryBufferSize); return(responseBody); }