public virtual void AfterReceiveReply(ref Message reply, object correlationState)
        {
            HttpResponseMessageProperty prop = (HttpResponseMessageProperty)reply.Properties[HttpResponseMessageProperty.Name];
            string body = ServiceManagementUtilities.ReadMessageBody(ref reply);

            logger(GeneralUtilities.GetHttpResponseLog(prop.StatusCode.ToString(), prop.Headers, body));
        }
        public virtual object BeforeSendRequest(ref Message request, IClientChannel channel)
        {
            HttpRequestMessageProperty prop = (HttpRequestMessageProperty)request.Properties[HttpRequestMessageProperty.Name];
            string body = ServiceManagementUtilities.ReadMessageBody(ref request);

            logger(GeneralUtilities.GetHttpRequestLog(prop.Method, request.Headers.To.AbsoluteUri, prop.Headers, body));

            return(request);
        }
        public object DeserializeReply(Message message, object[] parameters)
        {
            XDocument response = XDocument.Parse(ServiceManagementUtilities.ReadMessageBody(ref message));
            List <T>  results  = new List <T>();
            IEnumerable <XElement> contents   = response.Descendants(XName.Get("content", ServiceBusConstants.AtomNamespaceName));
            XmlSerializer          serializer = new XmlSerializer(typeof(T));

            foreach (XElement content in contents)
            {
                XElement data = content.Elements().First <XElement>();
                results.Add((T)serializer.Deserialize(new StringReader(data.ToString())));
            }

            if (response.Root.Name == XName.Get("feed", ServiceBusConstants.AtomNamespaceName))
            {
                List <T> collection = new List <T>();
                collection.AddRange(results);
                return(collection);
            }
            else
            {
                return(results[0]);
            }
        }