Some lines about XML validation in BizTalk

This post was originally published here.

In the BizTalk toolbox, you have two standard pipeline components that can perform this XML validation. These components have a very different behavior. Let’s have a detailed look.

It’s a good practice to have some XML validation in your BizTalk integration flows.  It prevents you of sending mal-formatted messages to back-end systems and it also gives you the opportunity to validate incoming messages.  In the BizTalk toolbox, you have two standard pipeline components that can perform this XML validation.  Let’s have a look…

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)

image

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

image

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

ABOUT

MEET THE YOUR AZURE COACH TEAM

Your Azure Coach is specialized in organizing Azure trainings that are infused with real-life experience. All our coaches are active consultants, who are very passionate and who love to share their Azure expertise with you.