While serializing operations with XmlSerializerFormatAttribute,
attributes xmlns:xsi and xmlns:xsd were not added to the message body.
XmlBodyWriter now adds the missing attributes.
Fixes #34413.
using System.ServiceModel.Description;
using System.Text;
using System.Xml;
+using System.Xml.Schema;
using System.Xml.Serialization;
namespace System.ServiceModel.Dispatcher
protected override void OnWriteBodyContents (XmlDictionaryWriter writer)
{
+ if (writer.WriteState == WriteState.Element) {
+ writer.WriteXmlnsAttribute ("xsi", XmlSchema.InstanceNamespace);
+ writer.WriteXmlnsAttribute ("xsd", XmlSchema.Namespace);
+ }
+
serializer.Serialize (writer, body);
}
}