Error: Cannot locate document specification because multiple schema matched the message type
This is small topic in BizTalk, But I have seen that people also stuck in this situation. Sometimes when this question or (can you have several same types of Messagetype in BizTalk Admin Console) asks in interview mostly people directly say that BizTalk cannot have two similar kind of schema although these schemas belong to different BizTalk applications.
They can say that because if they only use default pipeline and when any message process then you got exception that multiple schema match with the incoming file.
Sometime in BizTalk we require to use same schema in different application and those application should not interlink with each other with schema references.
You can have several same kinds of schemas in different BizTalk applications. Now question is how to implement that.
You can implement in two ways.
- Provide Schema name in DocumentSpecNames in XML Receive Pipeline
Configure Specific Schema in DocumentSpecNames property in XML Receive Pipeline on Receive Location. So, after receiving message from Receive Port. In this XML Receive Pipeline BizTalk will know that which BizTalk applications should processed.
To provide schema name, you select particular schema and open the properties on schema as below:
You provide Schema’ name and assembly in DocumentSpecNames in XML Receive pipeline.
DocumentSpecNames: <Name>, <Assembly>
e.g. Test.DocSchema, Test, Version=220.127.116.11, Culture=neutral, PublicKeyToken=28e25aa7767eb2e2
2. Add schema in XML disassembler in pipeline component:
You can do the same thing through creating pipeline in BizTalk Application. In Disassemble stage you need to add XML Disassembler and in the property for XML disassembler component, Document Schema tab is defined.
You need to open the collection of Document schemas tab and select the respective schema which need to process in the BizTalk application. And add this pipeline on Receive Port.
Note: For BizTalk best practices you should always add schema in XML disassembler stage. So that in future if any other application will deploy with same schema then it will not affect the current application.