BizTalk MessageType: case-sensitive or case-insensitive?

This post was originally published here.

This blog post is all about how schemas are resolved by the BizTalk XML Disassembler. Does BizTalk treats the MessageType in a case-sensitive or a case-insensitive way? Let’s have a look!

As you all know, the BizTalk XML Disassembler checks – by default – if a schema is deployed that matches the incoming message.  BizTalk does this via the BTS.MessageType, which is a combination of TargetNamespace#RootNode.  This BTS.MessageType must be unique in your BizTalk Group.  If two schemas are deployed with the same TargetNamespace#RootNode, the XML Disassembler will throw this error message:

“Cannot locate document specification because multiple schemas matched the message type”

Lately we had an issue, related to this subject.  We had two schemas deployed, that varied only by case.  Below, you find a similar example.

image

Now the question is: will BizTalk treat these schemas as identical schemas or not? My first guess was that BizTalk would treat these schemas as unique because it’s related to XML, which is case-sensitive.  However, when processing one of the two messages, the XML Disassembler threw an error because multiple schemas matched the message type.

I investigated how BizTalk resolved the schema, so I turned on SQL Server Profiler.  There, I discovered this entry:

exec bt_GetDocSpecInfoByMsgType 
   @nvcMsgtype=
   N'http://Codit.BizTalk.Blog.REQUEST#REQUEST',@iPipelineAssemblyId=2,@iFlag=@p3

The most important query of the GetDocSpecInfoByMsgType stored procedure is this one:

image

Because my SQL Server Collation, Latin1_General_CI_AS, is case-insensitive, the query results into 2 matched schemas, so the XML Disassembler will throw an exception.

After some searching on MSDN I’ve found this remark:

“If you will be using two namespaces that vary only by case, the BizTalk database must be installed with a case-sensitive collation. Examples of case-sensitive collations include binary and non-binary collations with case-sensitivity enabled. If this is not done, schema resolution will fail because XML is case-sensitive.”

Conclusion

Is the BTS.MessageType case-sensitive or case-insensitive?
It depends on your SQL Server Collation.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s