Monday, April 21, 2014

XML Disassembler Vs XML Validator

Validation in pipeline -
http://blog.codit.eu/post/2012/11/14/Some-lines-about-XML-validation-in-BizTalk.aspx

It is worth noting the difference between validation behavior of  XML Disassembler & XML Validator component.


XML Disassembler XML Validator

Validates document structure only
Validates both structure and defined restrictions
Validates against configured document schema only.
If the input message has another TargetNamespace#RootNodeName combination,
an exception will be thrown (can’t recognize the data)


Validates against schema configured.
If the input message has another TargetNamespace#RootNodeName combination, no XML validation will be performed.
If document schema is not configured, error received - "Validation can only be performed when document schemas are provided."

If document schema is not configured, it retrieves the XML definition from the BizTalkMgmtDb, at run-time, using the TargetNamespace#RootNodeName combination. And validates against the same.
If no relevant schema found for input message validation, error received - "The XML Validator cannot retrieve the document specification using the type 'XXX' "
If document schema is configured improperly(or fully qualified schema name not configured), error received - "No Disassemble stage components can recognize the data." If document schema is configured improperly(or fully qualified schema name not configured)
  "The document specification <TestSchemaWrongName> from assembly <Schemas, Version=1.0.0.0, Culture=neutral, PublicKeyToken=df56015ea0377400> failed to load. Verify the schema for this document specification is deployed and is in the Global Assembly Cache."
If validation fails, error received - "Validation failed." If validation fails, error received - The 'http://TestDocumentSchema:InvalidFieldName' element has an invalid value according to its data type.

One more finding - we can specify multiple schemas in property DocumentSchema. They will have fully qualified name, separated by '|' . e.g.
RnD.Schemas.Request,RnD.Schemas, Version=1.0.0.0, Culture=neutral, PublicKeyToken=df56015ea0377400 | RnD.Schemas.Error,RnD.Schemas, Version=1.0.0.0, Culture=neutral, PublicKeyToken=df56015ea0377400