I recently posted a question on StackOverflow:
SOAP message deserialization issue in WCF – fields have null values
It was something about one of the WCF serialization engines, XmlSerializer, used to serialize/deserialize SOAP messages. The deserialization didn’t work at first – some namespace issues.
Back to present 🙂
Fields decorated with [XmlElement, MessageBodyMember] are deserialized fine now if they are simple types.
There is a problem regarding custom types: they are set, but their fields have null values 🙁
Is there a configuration I should make on the XmlSerializer?
[MessageContract]
public class Request
{
[XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified), MessageBodyMember]
public XType X { get; set; }
}
[what to write here?]
public class XType
{
[XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified), body member?]
public string AString { get; set; }
... maybe another nested complex objects
}
I had those serialization problems because the client of the service has a serialization engine that is not “compatible” with the ones that WCF uses. The request was still standard XML, of course (SOAP 1.2), but hey, WCF is a Microsoft product 🙂
Some workarounds: