/// <summary>
/// Send the request to address book server endpoint.
/// </summary>
/// <param name="requestBody">The request body.</param>
/// <param name="requestType">The type of the request.</param>
/// <param name="cookieChange">If the session context cookie changed.</param>
/// <returns>The common response.</returns>
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);
}