I am new to WCF and have a basic question about the [MessageBodyMember] attribute.
As far as I understand, in the case of the [DataMember] attribute, unless you set IsRequired=true there will not be a problem getting and deserializing the message.
What will happen if you send a message that is missing MessageBodyMembers? (From an earlier version of the interface, for example)
If you don't have a MessageBodyMemberAttribute defined where you're explicitly defining the message contract with a MessageContractAttribute, the message will still be processed to the best of it's ability.
From the MSDN documentation "Using Message Contracts" (under the "Message Contract Versioning" section, emphasis mine):
Message bodies have similar versioning rules—both missing and additional message body parts are ignored.
Of course, if your contract (or implementation) isn't constructed to handle a missing part of the body, then that's a separate issue altogether.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With