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.