If you’ve been around BizTalk for a while, like me, you most certainly have gotten this error many times.

The normal solutions are:
1) Make sure you schema is deployed
2) Make sure your schema is not deployed more than once
3) Set “AllowUnrecognizedMessage” to True in the XML Disassembler.
4) Make sure the file you dropped has the proper namespace and root element.

To review, in BizTalk MessageType is the TargetNamespace#RootElement.

Here was the exact message I got when I dropped my test file:

<pre>
The Messaging Engine failed while executing the inbound map
 for the message coming from source URL:"e:\Integration\Inbound\CPChemNew\204\*.xml" 
 with the Message Type "http://abc.com/X12/204/CPChem2#X12_00401_204". 
 
Details:"Finding the document specification by message type "ST" failed. Verify the schema deployed properly. " 
</pre><code>

The message type looked okay. 
http://abc.com/X12/204/CPChem2#X12_00401_204

But what was this "ST" in the second message? 

<h4>Solution</h4>
I was converting a regular schema to an envelope schema in order to accomplish debaching. "Body XPath" is a parm you set so that the receive XML pipeline will automatically split the message into multiple messages). 

I put the "Body XPath" one element too low.  It should have split on X12_00401_204, but actually split the message into an ST, and other similar segments.

<h4>Insights</h4>
Here's what I didn't understand.  I'm not sure why, but after debatching, the XML Disasembler on the Receive Pipelines, decides that it needs to verify that the target schema exists as well.  Thus, the error on "ST". 

<h4>How I Solved It</h4>
1. I did a test map in Visual Studio and got the results of the test map. 
2. And then dropped that into the appropriate Receive Location (different from the one above).
3. Since I had tracking turned on, I check the "Tracked Message Events", and saw multiple "Transmission Failed" and looking at the body of each, I see one file has <ST> as the root, one has <B2> as the root, and so on. 
4. The other thing I should have noticed was that in the error, the message type should have been: "http://abc.com/X12/204/CPChem2#X12_00401_204Looping" instead of "http://abc.com/X12/204/CPChem2#X12_00401_204".  That should have hinted to me that maybe the debatching was happening.  X12_00401_204Looping and X12_00401_204 were so similar I didn't notice, so lesson learned here is don't assume and be exact. 

The file I'm trying to build looks like this: 
<code><pre>
<ns0:X12_00401_204_LOOPING xmlns:ns0="http://abc.com/X12/204/CPChem2">
  <X12_00401_204>
           <ST> 
              etc... 
</pre>

In EDI, a customer can send multiple 204s, but we wanted a single file with multiple 204s in it (too complex to explain here).

The next thing I need to do is make sure I have a scheme that matches , and I need to add a namespace to that as well. So more work to be done, but now I’m back on track. What I need is two schemas, and the Envelope schema can import and reference the other one.