This post was originally published here.
XML Disassembler
The default configuration of the XML Disassembler will not perform any kind of XML validation on the message
If you want to enable XML validation on the XML Disassembler you need to set Validate document structure to True and explicitly set the Document schema(s) that need to be validated. Compared to the specified Documents schema(s):
- If the processed message has the same TargetNamespace#RootNodeName combination, XML validation will be performed
- If the processed message has another TargetNamespace#RootNodeName combination, an exception will be thrown (can’t recognize the data)
XML Validator
The default configuration of the XML Validator will already perform XML validation. How? It retrieves the XML definition from the BizTalkMgmtDb, at run-time, using the TargetNamespace#RootNodeName combination.
- If a matching schema is found, XML validation will be performed on the processed message
- If no matching schema is found, the XML Validator will throw an exception (cannot retrieve document specification)
You can also explicitly specify at design-time the Document schema(s). Compared to the specified Documents schema(s):
- If the processed message has the same TargetNamespace#RootNodeName combination, XML validation will be performed
- If the processed message has another TargetNamespace#RootNodeName combination, no XML validation will be performed
Conclusion
You see a different behavior when comparing the components, especially when specifying Document schema(s). Depending on your needs, you can choose the appropriate setup. I mostly opt for the combination of the XML Disassembler and XML Validator, both with their default configuration. It has the advantage that you don’t need to configure anything at design-time. They work together in this way:
- The XML Disassembler is responsible for retrieving the BTS.MessageType, promoting context properties and debatching
- The XML Validator will validate all messages, deciding at run-time which schema to use