////////////////////////////////////////////////////////////////////////////////////////////////////
 /// <summary>Function to set the Bluevia Api service response info. Hedares and body.</summary>
 /// <param name="addData">The headers and body of the response.</param>
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 public void SetResponseAdditionalData(AdditionalResponseData addData)
 {
     if (addData==null)
     {
         BlueviaException ex = new BlueviaException("Null AdditionalData parameter when setting AdditionalData in Bluevia_Response.");
         ex.code = ExceptionCode.InvalidArgumentException;
         throw ex;
     }
     else
     {
         this.additionalData = addData;
     }
     
 }
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 /// <summary>Function to set the Bluevia Api service exception info, received in a BV_Response.</summary>
 /// <param name="addData">The body and the headders of the service exception.</param>
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 public void SetConnectorExceptionAdditionalData(AdditionalResponseData addData){
     this.addData = addData;
 }
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 /// <summary>Initializes a new instance of the <see cref="BV_Response"/>.</summary>
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 public BV_Response()
 {
     code = string.Empty;
     message = string.Empty;
     additionalData = new AdditionalResponseData();
 }
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary> Private method to extract the headers and the body of the response, 
        /// and fill with that info the AdditionalResponseData of a Bluevia_Response, or a 
        /// BV_ConnectorException</summary>
        /// <remarks>   2012/03/14. </remarks>
        /// <returns>A full Core.Schemas.AdditionalResponseData</returns>
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        private AdditionalResponseData CreateAdditionalData()
        {
            byte[] responseData = null;
            //Saving the responseBody as string:
            using (Stream stream = response.GetResponseStream())
            {
                MemoryStream memStream = new MemoryStream();
                stream.CopyTo(memStream);
                responseData = memStream.ToArray();
            }

            AdditionalResponseData addData = new AdditionalResponseData();
            //Setting Body:
            addData.SetBody(responseData);

            //Setting Headers:
            for (int i = 0; i < response.Headers.Count; i++)
            {
                StringBuilder valuesAppender = new StringBuilder();
                foreach (string value in response.Headers.GetValues(i))
                {
                    valuesAppender.Append(value);
                }

                addData.AddHeader(
                    response.Headers.GetKey(i)
                    , valuesAppender.ToString());
            }
            return addData;
        }