Data Contract vs Message Contract in WCF – WCF Service Tutorial

If you are new to Data Contract and Message Contract. Please read my earlier blogs. Data Contract Message in WCF

Data Contract has very less control over SOAP message, while Message Contract has full control.

Data Contract vs Message Contract

  • Data Contract is used to define the structure of data which will be exchanged between client and server.
  • On another side, Message Contract is used to control the SOAP message. For example, if you have developed a service which requires Authentication, in this case, user credentials should be sent in SOAP message header and here the role of Message Contract starts.

Leave a Comment