User-1662538993 posted
Here is the details for why we use MessageContract -
Please check this thread from where i have copy pasted it below:
http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/ccbf6cb3-23dd-4e95-86a2-4ecdd390f9b1/
Data Contracts:
WCF data contracts provide a mapping function between .NET CLR types that are defined in code and XML Schemas Definitions defined by the W3C organization (www.w3c.org/) that are used for communication outside
the service.
Message Contracts:
Message contracts describe the structure of SOAP messages sent to and from a service and enable you to inspect and control most of the details in the SOAP header and body. Whereas data contracts enable interoperability through the XML Schema Definition
(XSD) standard, message contracts enable you to interoperate with any system that communicates through SOAP. Using message contracts gives you complete control over the SOAP message sent to and from a service by providing access to the SOAP headers and bodies
directly. This allows use of simple or complex types to define the exact content of the SOAP parts.
The example you have posted use message header to pass information to the client and hence uses message contract. You can use data contract as well just for the purpose of file upload function.