Yossi Dahan [BizTalk]

Google
 

Friday, August 04, 2006

Schema Validation -- Gotcha!

I've noticed a long time ago, in the early days of BizTalk 2004 that the "Validate Instance" option in Visual Studio and the validation that actually occurs using the XmlDisassembler or XmlValidator in a receive pipeline are not identical. We had errors not being reported by the validate instance before, which is quite worrying, but our findings from today regarding Schema validation takes it another step -

Apparently "Validate Instance" is not sesitive at all to namespace differences, so if you take a BTS schema, generate an instance using VS 2005, edit the xml to change the target namespace and then validate that [amended] instance in VS 2005; then the validation will succeed, which is wrong.

By comparison, if you run the same [amended] instance through a code xml validate component (I used XmlValidatingReader) then the validation fails, as you would expect. Any de-serialization attempted against that instance would not work either – as expected!

(Thanks to Ben for confirming this one out so carefully!)

1 Comments:

  • We've noticed a similar situation with the reuse of common type schemas that don't define a namespace (chameleon schemas). Instance documents validate correctly against these schemas using the "Validate Instance" feature, but fail validation in the XML disassembler or validator components.

    The pipeline generates an error about certain base types being undefined. These "undefined" types are defined in our reusable chameleon schemas. Executing schema validation against the instance document using a C# test project passes as well. This leads me to wonder if BizTalk is having an issue resolving the <include> (to the base types schemas) or some other bug.

    I know there is a designer bug with regards to including two reusable schemas if they share a common reference to another reusable schema. Sometimes this can be resolved by re-ordering the <include> statements, while other times it can't be resolved at all.

    I'm currently stuck trying to resolve this issue; I'd prefer not to have to refactor our schemas to work around this issue but it looks like I might have to.

    By Anonymous Joel, at 28/03/2007, 04:19  

Post a Comment

<< Home