I was stuck with a shockingly frustrating error message in BizTalk, but thanks to an obscure tweak identified in the BizTalk Developer’s Troubleshooting Guide, all is right with the world.

The error I kept getting was Document type does not match any of the given schemas. How did this come about? I receive a batch message into BizTalk, and want each item in the batch to process through the orchestration individually. No problem, just use the standard XML Receive Pipeline and an envelope schema, and *poof* you have debatching. Worked fine with a FILE adapter. Once I created a web service input channel (doing an “expose schema as web service” since the orchestration accepts an individual message, but BizTalk itself must accept the full batch) I started getting the error above. What was mind-boggling was that the schema was indeed deployed and listed in the server repository. I even ran SELECT * FROM bt_documentspec ORDER BY msgtype DESC against the MessageBox database to ensure that my namespace#root was a visible object to BizTalk. Clearly something in the generated web service was hosing me, but everything looked fine to me.

So, how did I fix this? The newsgroups were no help, as I never found anyone who got an answer to this question. After banging my head for a few hours, I took a break to read the BizTalk Developer’s Troubleshooting Guide. I see the question in the document which says Why do I receive errors when publishing my envelope schema? Hey, that’s MY problem! The solution was:

To modify the generated Web project for envelope schemas

  1. Open the .asmx.cs file.

  2. Edit the file and change bodyTypeAssemblyQualifiedName = <dll.name.version> to bodyTypeAssemblyQualifiedName = null

As soon as I did that, and reset IIS, my error went away. I’ve never seen that documented anywhere, which is odd given that this scenario doesn’t seen that outlandish. Hopefully this helps some poor soul in the future.

Technorati Tags: BizTalk