다음을 통해 공유


Don't Check What Doesn't Have to be Correct

I'm trying to validate the structure of messages against schema but there are SOAP headers that I don't recognize. How do I check that these headers are correct?

SOAP headers already have a mechanism for saying whether you are required to deal with that header. The mustUnderstand attribute with a value of true means that processing the header is mandatory. The mustUnderstand attribute with a value of false or not set means that processing the header is optional. Since you don't recognize the header, it only makes sense to even bother with further validation if you aren't required to understand the header. If you're required to process the header, then you have no chance of correctly following the header's instructions if you don't recognize it.

Once you've established that the header is not required to be understood, further problems within the header shouldn't make a difference. The behavior of processing the message should be just like the header was omitted entirely.