BizTalk Schema Validation
- by Christopher House
Perhaps this one should be filed under: Obvious
Yesterday I created a new schema that is going to be used for a WCF receive. The schema has a bunch of restrictions in it, with the intention that we'd validate incoming messages against the schema. I'd never done message validation with BizTalk but I knew the XmlDisassembler component had an option for validating, so I figured it would be a piece of cake. Sadly, that was not to be the case.
I deployed my artifacts and configured my receive location's XmlDisassembler with what I thought to be the correct document spec name. I entered My.Project.Name.SchemaTypeName for the document spec and started running unit tests. All of them failed with the following error logged in the event log:
"WcfReceivePort_BizTalkWcfService/PurchaseOrderService" URI: "/BizTalkWcfService/PurchaseOrderService.svc" Reason: No Disassemble stage components can recognize the data.
I went to the receive port and turned on tracking, submitted another message, then went to the admin console and saved the message. It looked correct, but just to be sure, I manually validated it against the schema in my project. As expected, it validated correctly.
After a bit of thinking on this, I realized that I probably needed to fully qualify my document spec name, meaning, include the assembly name, as well as the type name. So, I went back to the receive location and changed the document spec to:
My.Project.Name.SchemaTypeName, My.Project.Name,Version=1.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxx
I re-ran my unit tests and everything was working as expected. So, note to self: remember to include the assembly name when setting the document spec. If you need an easy way to determine your schema name and assembly name, find your schema in the admin console and go to it's properties. On the property screen, look at the Name and Assembly properties. Your document spec will be "SchemaName, AssemblyName"