public void DeserializeRequest(Message message, object[] parameters)
        {
            object propObj;
            object[] bodyParameters = new object[parameters.Length - this.totalNumUTVars];

            if (bodyParameters.Length != 0)
            {

                if (message.Properties.TryGetValue(HttpRequestMessageProperty.Name, out propObj))
                {
                    var prop = (HttpRequestMessageProperty) propObj;
                    var contenttype = prop.Headers[HttpRequestHeader.ContentType];
                    if (contenttype != null)
                    {
                        if (jsonContentTypes.IsMatch(contenttype))
                        {
                            JsonSerializer js = new JsonSerializer();
                            js.Deserialize(operation, parameterNames, message, parameters);
                            return;
                        }
                        if (protoContentTypes.IsMatch(contenttype))
                        {
                            ProtobufSerializer js=new ProtobufSerializer();
                            js.Deserialize(operation, parameterNames, message, parameters);
                            return;
                        }
                    }
                }
                XmlSerializer x = new XmlSerializer();
                x.Deserialize(operation, parameterNames, message, parameters);
            }
            int j = 0;
            UriTemplateMatch utmr = null;
            string UTMRName = "UriTemplateMatchResults";
            if (message.Properties.ContainsKey(UTMRName))
            {
                utmr = message.Properties[UTMRName] as UriTemplateMatch;
            }
            else
            {
                if (message.Headers.To != null && message.Headers.To.IsAbsoluteUri)
                {
                    utmr = this.uriTemplate.Match(this.baseAddress, message.Headers.To);
                }
            }
            NameValueCollection nvc = (utmr == null) ? new NameValueCollection() : utmr.BoundVariables;
            for (int i = 0; i < parameters.Length; ++i)
            {
                if (this.pathMapping.ContainsKey(i) && utmr != null)
                {
                    parameters[i] = nvc[this.pathMapping[i]];
                }
                else if (this.queryMapping.ContainsKey(i) && utmr != null)
                {
                    string queryVal = nvc[this.queryMapping[i].Key];
                    parameters[i] = this.qsc.ConvertStringToValue(queryVal, this.queryMapping[i].Value);
                }
                else
                {
                    parameters[i] = bodyParameters[j];
                    ++j;
                }
            }
        }
        public void DeserializeRequest(Message message, object[] parameters)
        {
            object propObj;

            object[] bodyParameters = new object[parameters.Length - this.totalNumUTVars];

            if (bodyParameters.Length != 0)
            {
                if (message.Properties.TryGetValue(HttpRequestMessageProperty.Name, out propObj))
                {
                    var prop        = (HttpRequestMessageProperty)propObj;
                    var contenttype = prop.Headers[HttpRequestHeader.ContentType];
                    if (contenttype != null)
                    {
                        if (jsonContentTypes.IsMatch(contenttype))
                        {
                            JsonSerializer js = new JsonSerializer();
                            js.Deserialize(operation, parameterNames, message, parameters);
                            return;
                        }
                        if (protoContentTypes.IsMatch(contenttype))
                        {
                            ProtobufSerializer js = new ProtobufSerializer();
                            js.Deserialize(operation, parameterNames, message, parameters);
                            return;
                        }
                    }
                }
                XmlSerializer x = new XmlSerializer();
                x.Deserialize(operation, parameterNames, message, parameters);
            }
            int j = 0;
            UriTemplateMatch utmr     = null;
            string           UTMRName = "UriTemplateMatchResults";

            if (message.Properties.ContainsKey(UTMRName))
            {
                utmr = message.Properties[UTMRName] as UriTemplateMatch;
            }
            else
            {
                if (message.Headers.To != null && message.Headers.To.IsAbsoluteUri)
                {
                    utmr = this.uriTemplate.Match(this.baseAddress, message.Headers.To);
                }
            }
            NameValueCollection nvc = (utmr == null) ? new NameValueCollection() : utmr.BoundVariables;

            for (int i = 0; i < parameters.Length; ++i)
            {
                if (this.pathMapping.ContainsKey(i) && utmr != null)
                {
                    parameters[i] = nvc[this.pathMapping[i]];
                }
                else if (this.queryMapping.ContainsKey(i) && utmr != null)
                {
                    string queryVal = nvc[this.queryMapping[i].Key];
                    parameters[i] = this.qsc.ConvertStringToValue(queryVal, this.queryMapping[i].Value);
                }
                else
                {
                    parameters[i] = bodyParameters[j];
                    ++j;
                }
            }
        }