Can someone point (or answer here, if possible) me to the material/reference which describes how to use MessageContract in WCF operations correctly. I have read this document.
I would like to know:
1) What limitations are there while using MessageContract as return value of the operation contract?
2) What if the class decorated withe the MessageContract has a property which returns an object of the class which is decorated with XmlRoot?
3) Are there any limitations or considerations if MessageContract is going to contain arrays or collections?
MessageContractfor request description you have to use it for response as well and vice-versa. The only exception are operations returning void or accepting no parameters.DataContractSerializerby default but you can switch it toXmlSerializerby marking contract, service or operation withXmlSerailazerFormatattribute. In such case serialization will ignoreDataContract/DataMemberattributes and start to use common Xml serialization attributes (includingXmlRoot). What is most important is thatMessageContractis not related to used serializer – it can be used with bothDataContractand Xml serialization.MessageContract– each is marked withMessageBodyMemberattribute.