Introduction BizTalk Document Schemas – Part II

  • Sandro Pereira
  • Jul 4, 2009
  • 3 min read

If the Root Node is the “Name” of your message, the Namespace is its “Surname.” In a global enterprise environment, you might have ten different “Invoice” messages. Namespaces are the only way BizTalk knows which one belongs to SAP and which one belongs to your web portal.

Schema Namespaces

Has posted before – Introduction BizTalk Document Schemas – about this topic. BizTalk Server uses a combination of Namespace + Root Node name to identify and resolve schema references.

Therefore, it is possible to have two schemas with the same namespace as long as the root name designation is different, or the opposite, two schemas with the same root node and different namespace designation.

📝 One-Minute Brief

Namespaces are the unique identifiers for BizTalk messages. Combined with the Root Node, they form the MessageType (Namespace#RootNode). This post explains why you must never leave the Target Namespace as default, how to structure them for long-term maintenance, and how they impact message routing and subscriptions.

The Target Namespace

Every Document Schema has a Target Namespace property. By default, Visual Studio fills this with a project-specific URI, but you should always change it to a meaningful, company-standard URI.

By default, BizTalk Schema editor puts the namespace with the following structure:

  • http://[SOLUTIONNAME].[SCHEMANAME]

Where:

  • [SOLUTIONNAME] is the name of the project solution
  • [SCHEMANAME] is the name of the schema

You can change the namespace by:

  • Selecting <schema> node, right-click and select Properties;
  • Modify Target Namespace property

There is no standard naming for BizTalk namespaces. Normally, companies adopt their own specification. However, one well-adopted structure namespace is:

  • http://[COMPANYNAME].[PROJECT].BizTalk.Schemas.[SCHEMA].[VERSION]

My “standard” is a little different (simpler):

  • http://[COMPANYNAME].[PROJECT].Schemas.[SCHEMA]
  • And in some cases, I will add the “.[VERSION]” part.

How BizTalk Uses Namespaces

When a message enters the BizTalk MessageBox, the XML Disassembler (inside the Pipeline) looks at the incoming XML. It finds the namespace and the root node and combines them to create the MessageType:

http://Schemas.DevScope.com/Invoices#Invoice

BizTalk Server will then try to determine, based on this MessageType, whether it can find a namespace in the environment.

  • If a match is found, BizTalk can then validate the message, promote any “Promoted Properties,” and allow the message to be picked up by subscribers.
  • If no match is found, BizTalk will still publish the message to the MessageBox with an error saying that it cannot identify/recognize the message.

The “PassThru” Exception

It is important to remember: If you use the PassThruReceive pipeline, BizTalk does not look at the namespace. The message enters the MessageBox with no identity (MessageType is null). This is why you cannot use Content-Based Routing (CBR) or Orchestrations effectively with PassThru pipelines unless you are routing based on other metadata (like the filename).

Hope you find this helpful! If you liked the content or found it useful and would like to support me in writing more, consider buying (or helping to buy) a Star Wars Lego set for my son. 

Thanks for Buying me a coffe
Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.

Leave a Reply

Your email address will not be published. Required fields are marked *

The Ultimate Cloud
Management Platform for Azure

Supercharge your Azure Cost Saving

Learn More
Turbo360 Widget

Back to Top