Freigeben über


Ignoring MustUnderstand

How can I configure a client or server to handle messages even if a required header isn't understood?

The SOAP mustUnderstand attribute on a header is used to indicate that processing the header is required in order to properly handle the message. If the header can't be processed, then a fault is supposed to be generated. In some cases though, you might want to process a message despite not having handled some of the required headers.

The check for mustUnderstand is done after a message is received. Each message header marked with the mustUnderstand attribute is given a MustUnderstand flag. During processing, each message header that is processed is given an Understood flag. The MustUnderstand check simply validates that every header flagged as MustUnderstand was also flagged as Understood.

You can disable the MustUnderstand check through the ServiceBehavior attribute. On the ServiceBehavior attribute for the service definition, the value of the ValidateMustUnderstand property is tested to see whether the MustUnderstand check should be run.