Message Contracts in WCF

Message contracts provide the ultimate control over the formatting of the SOAP messages. In most cases you will not need to employ this level because data contracts provide most of the control you will need. However, should the need arise for this level of customization, message contracts are available.
Probably the biggest reason you would need to obtain this level of control is interoperability. A message contract provides the level of interoperability you would need when you need to communicate with clients or other systems that may use a particular WSDL or schema, or cases when there is some question or concern regarding the SOAP message structure, such as controlling security issues.
What message contracts allow you to do is to have more control over the way contract parameters are formatted in SOAP messages, such as whether or not information goes in the message body or message headers. You should keep in mind that WCF does this automatically, but if you want to override this, you need to use message contracts.

Tagged . Bookmark the permalink.

Leave a Reply