diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2009-10-07 21:48:01 +0400 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2009-10-07 21:48:01 +0400 |
commit | baedd9881f3f0a7e53532ffad72f079b6851b99b (patch) | |
tree | b7db1db2daca74bd3efd3757ced2bb5146c2e5e7 /mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher | |
parent | c55e49254e3d5e928de5b203153dd6f5ca477300 (diff) |
2009-10-07 Atsushi Enomoto <atsushi@ximian.com>
* WebMessageFormatter.cs : also fix wrapped message deserialization.
It should expect FooResponse (body WrapperName), not FooResult
(ReturnValue part Name).
svn path=/trunk/mcs/; revision=143694
Diffstat (limited to 'mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher')
-rw-r--r-- | mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/ChangeLog | 6 | ||||
-rw-r--r-- | mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebMessageFormatter.cs | 20 |
2 files changed, 16 insertions, 10 deletions
diff --git a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/ChangeLog b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/ChangeLog index 299ede8e73c..30b93baca4b 100644 --- a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/ChangeLog +++ b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/ChangeLog @@ -1,5 +1,11 @@ 2009-10-07 Atsushi Enomoto <atsushi@ximian.com> + * WebMessageFormatter.cs : also fix wrapped message deserialization. + It should expect FooResponse (body WrapperName), not FooResult + (ReturnValue part Name). + +2009-10-07 Atsushi Enomoto <atsushi@ximian.com> + * WebMessageFormatter.cs : when they serialize Wrapped message, it first writes "root" and then the wrapper element. 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 12e32896038..76c438ec669 100644 --- a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebMessageFormatter.cs +++ b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebMessageFormatter.cs @@ -145,15 +145,15 @@ namespace System.ServiceModel.Description switch (msgfmt) { case WebContentFormat.Xml: if (IsResponseBodyWrapped) - return GetSerializer (ref xml_serializer, p => new DataContractSerializer (p.Type, p.Name, p.Namespace)); + return GetSerializer (ref xml_serializer, b => new DataContractSerializer (b.ReturnValue.Type, b.WrapperName, b.WrapperNamespace)); else - return GetSerializer (ref xml_serializer, p => new DataContractSerializer (p.Type)); + return GetSerializer (ref xml_serializer, b => new DataContractSerializer (b.ReturnValue.Type)); break; case WebContentFormat.Json: if (IsResponseBodyWrapped) - return GetSerializer (ref json_serializer, p => new DataContractJsonSerializer (p.Type, p.Name)); + return GetSerializer (ref json_serializer, b => new DataContractJsonSerializer (b.ReturnValue.Type, b.WrapperName)); else - return GetSerializer (ref json_serializer, p => new DataContractJsonSerializer (p.Type)); + return GetSerializer (ref json_serializer, b => new DataContractJsonSerializer (b.ReturnValue.Type)); break; default: throw new NotImplementedException (); @@ -162,11 +162,11 @@ namespace System.ServiceModel.Description XmlObjectSerializer xml_serializer, json_serializer; - XmlObjectSerializer GetSerializer (ref XmlObjectSerializer serializer, Func<MessagePartDescription,XmlObjectSerializer> f) + XmlObjectSerializer GetSerializer (ref XmlObjectSerializer serializer, Func<MessageBodyDescription,XmlObjectSerializer> f) { if (serializer == null) { MessageDescription md = GetMessageDescription (MessageDirection.Output); - serializer = f (md.Body.ReturnValue); + serializer = f (md.Body); } return serializer; } @@ -293,12 +293,12 @@ namespace System.ServiceModel.Description var reader = message.GetReaderAtBodyContents (); - if (IsResponseBodyWrapped && md.Body.WrapperName != null) - reader.ReadStartElement (md.Body.WrapperName, md.Body.WrapperNamespace); + if (IsResponseBodyWrapped) + reader.ReadStartElement ("root", String.Empty); // note that the wrapper name is passed to the serializer. - var ret = serializer.ReadObject (reader, false); + var ret = serializer.ReadObject (reader, true); - if (IsResponseBodyWrapped && md.Body.WrapperName != null) + if (IsResponseBodyWrapped) reader.ReadEndElement (); return ret; |