I have a WCF service where Im building up a block of XML using an XmlWriter. Once complete I want to have the WCF return it as an XmlDocument.
But if I have XmlDocument in the [OperationContract] it doesnt work:
[OperationContract]
XmlDocument GetNextLetter();
The WCF test utility gives:
System.Runtime.Serialization.InvalidDataContractException: Type 'System.Xml.XmlDocument' cannot be serialized.
append xmlserializer on what you did in the operational contract
[OperationContract,XmlSerializerFormat]
XmlDocument GetNextLetter();
this will do it !