System.ServiceModel 4.0.0.0 System.Attribute

This class contains properties common to all parts of a SOAP message. For example, all parts have a name and a namespace, and potentially a level of security applied.

For information on controlling the serialization of the contents of a SOAP body without modifying the default SOAP envelope itself, see , Specifying Data Transfer in Service Contracts, and Data Contracts Overview.

For more information about creating message contracts, see Using Message Contracts.

Declares the base members for and .

- Constructor
  4.0.0.0
  To be added.

  Initializes a new instance of the class.

- Property
  4.0.0.0
  System.Boolean To be added. To be added.

  When overridden in a derived class, gets a value that indicates whether the member has a protection level assigned.

- Property
  4.0.0.0
  System.String To be added. To be added.

  Specifies the name of the element that corresponds to this member.

- Property
  4.0.0.0
  System.String To be added. To be added.

  Specifies the namespace of the element that corresponds to this member.

- Property
  4.0.0.0
  System.Net.Security.ProtectionLevel To be added.

  To make use of the property in either the or attributes you must properly configure the binding and behaviors. If these security features are used without a proper configuration (for example, using with a message part without supplying security credentials) an exception is thrown at run time.

  In addition, the protection level is determined for each header individually. However, the SOAP body has only one protection level, regardless of the number of body parts. The protection level of the body is determined by the highest property value of all the body parts. For example, consider the following class:

  `[MessageContract] public class PatientRecord { [MessageHeader(ProtectionLevel=None)] public int recordID; [MessageHeader(ProtectionLevel=Sign)] public string patientName; [MessageHeader(ProtectionLevel=EncryptAndSign)] public string SSN; [MessageBody(ProtectionLevel=None)] public string comments; [MessageBody(ProtectionLevel=Sign)] public string diagnosis; [MessageBody(ProtectionLevel=EncryptAndSign)] public string medicalHistory; }`

  In this example, the recordID header is not protected, patientName is signed, and SSN is encrypted and signed. There is at least one body part, medicalHistory, with and thus the entire message body is encrypted and signed, even though the comments and diagnosis body parts specify lower protection levels.

  The protection behavior at runtime is the combination of the protection-level values set on the following properties. These properties have a hierarchical structure. Setting the outermost value establishes the default setting for all narrower scopes unless a different value for a narrower scope is explicitly set. In this case, the outer value remains the default for all narrower scopes with the exception of that specifically set.

  For example, if is set to and no other narrower scopes have protection level settings, all messages in an operation contract are encrypted and signed. If, however, one of those operations has the set to , then the messages for that operation are signed but all other messages in the contract are encrypted and signed.

  For details about protection levels and their assumptions and scopes, see Understanding Protection Level.

  The scopes at which these values are set are:

  The property on .

  The property on .

  When there is no protection level explicitly specified on the contract and the underlying binding supports security (whether at the transport or message level), the effective protection level for the whole contract is . If the binding does not support security (such as ), the effective is for the whole contract. The result is that depending upon the endpoint binding, clients can require different message or transport level security protection even when the contract specifies .

  Specifies whether the member is to be transmitted as-is, signed, or signed and encrypted.