private ChunkedResponse SendAddressBookRequest(IRequestBody requestBody, RequestType requestType, bool cookieChange = true)
{
byte[] rawBuffer = null;
ChunkedResponse chunkedResponse = null;
// Send the execute HTTP request and get the response
HttpWebResponse response = MapiHttpAdapter.SendMAPIHttpRequest(this.site, this.addressBookUrl, this.userName, this.domainName, this.password, requestBody, requestType.ToString(), AdapterHelper.SessionContextCookies);
rawBuffer = MapiHttpAdapter.ReadHttpResponse(response);
string responseCode = response.Headers["X-ResponseCode"];
this.site.Assert.AreEqual<uint>(0, uint.Parse(responseCode), "The request to the address book server should be executed successfully!");
// Read the HTTP response buffer and parse the response to correct format
chunkedResponse = ChunkedResponse.ParseChunkedResponse(rawBuffer);
response.GetResponseStream().Close();
if (cookieChange)
{
AdapterHelper.SessionContextCookies = response.Cookies;
}
return chunkedResponse;
}