Wcf Message Contract

in IServcie1 :

public interface IService1
void Display(Employee empobj);

Employee ModifyEmployeeDetails(Employee empobj);

public class Employee
public int empid { get; set; }

[MessageBodyMember(ProtectionLevel = System.Net.Security.ProtectionLevel.Sign)]
public string  empname { get; set; }


In Service1 Class :

public class Service1 : IService1

#region IService1 Members

public void Display(Employee empobj)
Console.WriteLine(“in display… \n empid :” +empobj.empid + “\n empname :”+empobj.empname );


public Employee ModifyEmployeeDetails(Employee empobj)
Console.WriteLine(“Modify emp details… “);
return empobj;


In the SOAP envelope we can see Message is having two parts Message Header and Message Body

By using Message Contract we can have the control over message.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s