diff options
author | Atsushi Eno <atsushi@ximian.com> | 2011-08-25 05:11:25 +0400 |
---|---|---|
committer | Atsushi Eno <atsushi@ximian.com> | 2011-08-25 05:11:25 +0400 |
commit | ff0aa4e036c17c3d768e1b7771e6c7394c4721f0 (patch) | |
tree | 63ea5ba649af86bb3eba5a4dca1663431efe0807 /mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebMessageFormatter.cs | |
parent | eb1d9dc2daa16144190c5ca4a9db71679bb8b293 (diff) |
Revert GET switch for serializing requests. BodyWriter handles it better.
Diffstat (limited to 'mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebMessageFormatter.cs')
-rw-r--r-- | mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebMessageFormatter.cs | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebMessageFormatter.cs b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebMessageFormatter.cs index d486da79cc9..34d4040392b 100644 --- a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebMessageFormatter.cs +++ b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebMessageFormatter.cs @@ -338,30 +338,22 @@ namespace System.ServiceModel.Dispatcher Uri to; object msgpart = null; - if (info.Method == "GET") { - if (parameters.Length != md.Body.Parts.Count) - throw new ArgumentException (String.Format ("Parameter array length does not match the number of message '{0}' body parts: {1} expected, got {2}", Operation.Name, md.Body.Parts.Count, parameters.Length)); - - for (int i = 0; i < parameters.Length; i++) { - var p = md.Body.Parts [i]; - string name = p.Name.ToUpper (CultureInfo.InvariantCulture); - if (UriTemplate.PathSegmentVariableNames.Contains (name) || - UriTemplate.QueryValueVariableNames.Contains (name)) - c.Add (name, parameters [i] != null ? Converter.ConvertValueToString (parameters [i], parameters [i].GetType ()) : null); - else { - // FIXME: bind as a message part - if (msgpart == null) - msgpart = parameters [i]; - else - throw new NotImplementedException (String.Format ("More than one parameters including {0} that are not contained in the URI template {1} was found.", p.Name, UriTemplate)); - } + + for (int i = 0; i < parameters.Length; i++) { + var p = md.Body.Parts [i]; + string name = p.Name.ToUpper (CultureInfo.InvariantCulture); + if (UriTemplate.PathSegmentVariableNames.Contains (name) || + UriTemplate.QueryValueVariableNames.Contains (name)) + c.Add (name, parameters [i] != null ? Converter.ConvertValueToString (parameters [i], parameters [i].GetType ()) : null); + else { + // FIXME: bind as a message part + if (msgpart == null) + msgpart = parameters [i]; + else + throw new NotImplementedException (String.Format ("More than one parameters including {0} that are not contained in the URI template {1} was found.", p.Name, UriTemplate)); } - ret = Message.CreateMessage (messageVersion, (string) null, msgpart); - } else { - if (default_formatter == null) - default_formatter = BaseMessagesFormatter.Create (Operation); - ret = default_formatter.SerializeRequest (messageVersion, parameters); } + ret = Message.CreateMessage (messageVersion, (string) null, msgpart); to = UriTemplate.BindByName (Endpoint.Address.Uri, c); ret.Headers.To = to; |