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

SendAddressBookRequest() private method

Send the request to address book server endpoint.
private SendAddressBookRequest ( IRequestBody requestBody, RequestType requestType, bool cookieChange = true ) : CommonResponse
requestBody IRequestBody The request body.
requestType RequestType The type of the request.
cookieChange bool If the session context cookie changed.
return CommonResponse
        private CommonResponse SendAddressBookRequest(IRequestBody requestBody, RequestType requestType, bool cookieChange = true)
        {
            byte[] rawBuffer;
            CommonResponse commonResponse = null;
            WebHeaderCollection webHeaderCollection = AdapterHelper.InitializeHTTPHeader(requestType, AdapterHelper.ClientInstance, AdapterHelper.Counter);
            
            // Send the Execute HTTP request and get the response.
            HttpWebResponse response = this.SendMAPIHttpRequest(this.userName, this.password, requestBody, ServerEndpoint.AddressBookServerEndpoint, AdapterHelper.SessionContextCookies, webHeaderCollection, out rawBuffer);
            uint responseCode = AdapterHelper.GetFinalResponseCode(response.Headers["X-ResponseCode"]);
            this.Site.Assert.AreEqual<uint>(0, responseCode, "The request to the address book server should be executed successfully!");

            // Read the HTTP response buffer and parse the response to correct format.
            commonResponse = CommonResponse.ParseCommonResponse(rawBuffer);
            Site.Assert.IsNotNull(commonResponse.ResponseBodyRawData, "The response body should contains data.");
            this.VerifyRequestTypesForAddressBookServerEndpoint(response.Headers, commonResponse);
            this.VerifyAutoDiscover(response.StatusCode, ServerEndpoint.AddressBookServerEndpoint);
            this.VerifyAuthentication(response);

            response.GetResponseStream().Close();
            if (cookieChange)
            {
                AdapterHelper.SessionContextCookies = response.Cookies;  
            }

            return commonResponse;
        }
MS_OXCMAPIHTTPAdapter