Tuesday, May 9, 2017

MessageContract

A message contract used to control the structure of response and request, You can send information in soap header using message contract.

With the help of message header we can implement security by passing credential in header part.The SOAP header is implemented in the namespace system.web.services.protocol.

MessageHeader and MessageBodyMember?

A Message Header is applied to a member of a message contract to declare the member within the message header.

[MessageContract]
public class EmpRequest
{
[MessageHeader]
public string EmpId;
}


Message Body Member

A Message Body Member is applied to the member of a message contract to declare the members within the message body.

[MessageContract]
public class EmpResponse
{
[MessageBodyMember]
public Emp Obj;
}

When you go for Message Contract and when for Data Contract

If you want more control on your SOAP Message then you should go for a Message Contract.Do not mix message contract and data contract.

No comments:

Followers

Link