Microsoft.Protocols.TestSuites.Common.MapiHttpAdapter.Execute C# (CSharp) Method

Execute() public method

Send ROP request through MAPI over HTTP
public Execute ( byte rgbIn, uint pcbOut, byte &rawData ) : uint
rgbIn byte ROP request buffer.
pcbOut uint The maximum size of the rgbOut buffer to place response in.
rawData byte The response payload bytes.
return uint
        public uint Execute(byte[] rgbIn, uint pcbOut, out byte[] rawData)
        {
            uint ret = 0;

            ExecuteRequestBody executeBody = new ExecuteRequestBody();

            // Client requests server to not compress or XOR payload of rgbOut and rgbAuxOut.
            executeBody.Flags = 0x00000003;
            executeBody.RopBufferSize = (uint)rgbIn.Length;
            executeBody.RopBuffer = rgbIn;

            // Set the max size of the rgbAuxOut
            executeBody.MaxRopOut = pcbOut; // 0x10008;
            executeBody.AuxiliaryBufferSize = 0;
            executeBody.AuxiliaryBuffer = new byte[] { };

            HttpWebResponse response = SendMAPIHttpRequest(
                this.site,
                this.mailStoreUrl,
                this.userName,
                this.domain,
                this.userPassword,
                executeBody,
                "Execute",
                this.cookies);

            string responseCode = response.Headers["X-ResponseCode"];

            byte[] rawBuffer = ReadHttpResponse(response);
            response.GetResponseStream().Close();

            if (int.Parse(responseCode) == 0)
            {
                ChunkedResponse chunkedResponse = ChunkedResponse.ParseChunkedResponse(rawBuffer);

                ExecuteSuccessResponseBody responseSuccess = ExecuteSuccessResponseBody.Parse(chunkedResponse.ResponseBodyRawData);

                rawData = responseSuccess.RopBuffer;
                ret = responseSuccess.ErrorCode;
            }
            else
            {
                rawData = null;
                this.site.Assert.Fail("MAPIHTTP call failed, the error code returned from server is: {0}", responseCode);
            }

            this.cookies = response.Cookies;
            return ret;
        }