Showing posts with label implementation of message contract in wcf. Show all posts
Showing posts with label implementation of message contract in wcf. Show all posts

Wednesday, 27 March 2013

WCF Lesson 3:-Message Contract in WCF


Message Contract in WCF

Earlier we discuss two contract i.e. service contract and data contract. Now in this article I will discuss message contract.

In message contract data is sent in the format of SOAP message which in the form of header and body. With the help of message header we can implement security by passing credential in header part.

For Example:-

Create wcf service and add class to implement message contract.

[MessageContract]
public class EmployeeRecord
{
    [MessageHeader]
    public string token;

   
    [MessageBodyMember]
    public string name;
  
   [MessageBodyMember]
    public int empid;
}