Data Contract in WCF is an agreement between parties (i.e. a service and a client) that describes what type of data will be exchanged between them? On the other hand, Message Contract describes the structure of SOAP message that is passed between parties (i.e. a service and a client).
Using Data Contract, we control the contents (i.e. Payload data or message body) of a SOAP message while Message Contract provides complete control over structure of SOAP message.
Reference books, you may like:
Programming WCF Services: Design and Build Maintainable Service-Oriented SystemsWCF Multi-Layer Services Development with Entity Framework, 4th Edition
Learning WCF: A Hands-on Guide
Data Contract | Message Contract |
Data Contract allows us to control the name and order of XML element | Message Contract gives the full control on message and Message body. It allows us to change the header and body of XML. |
Data Contract is an agreement between Client and Service | Message Contract is the structure of XML that is exchanged between Client and Service |
Using Data contract, we control payload and message of the body | Using Message contract,we control behaviour and structure of the XML message |
|
|
© 2015, admin. All rights reserved.