This section is home to feature articles by regular and guest authors. Topics and opinions vary - some articles include discussions!
| Understanding Type Safety in BizTalk |
| Features - Feature Articles |
| Written by Erik Westermann |
| Friday, 20 February 2009 15:14 |
|
Type safety is among BizTalk Server's more visible features because it plays a key role in the operations of the underlying publish-subscribe system. Learn how BizTalk promotes XML into first-class types and why you need to know. BizTalk represents messages using XML - BizTalk determines the type of a message (analogous to a type in a programming language like C# or C++) based on two key parts of the XML message. BizTalk uses a combination of an XML message's namespace and root node name to describe a message's type. For example, you could describe a Person using the following XML instance document: <pers:Person xmlns:pers ="http://example.com/sample"> The document's namespace is http://example.com/sample and the name of the root node is Person. BizTalk represents the combination of the two like this: http://example.com/sample#Person The notation is important because you will see it when you debug routing failures, a common development-time error, and a in number of other places in BizTalk. When BizTalk receives a Person message it publishes the message to a general location (for those of you that are interested, the general location is called the MessageBox). Interested recipients, called subscribers, receive a notification that a new message is waiting. The notification contains the XML message so that the subscriber receives it immediately upon becoming aware of a new message. A subscriber describes the message it is interested in receiving using an expression similar to this: http://schemas.microsoft.com/BizTalk/2003/system-properties.MessageType == The expression is referred to as a subscription filter. While the left side of the expression (to the left side of the == operator) is new, the right side should look familiar - it is the message type of the Person message you saw earlier. Notice that the comparison is being made to a property called MessageType (you can see that just to the left of the == symbol). MessageType is an attribute of all BizTalk messages - that attribute effectively promotes a seemingly simple XML document into a first class type. Just as in programming with a language like C#, BizTalk enforces type safety to assure that you cannot send a message to a subscriber that cannot process it, or assign incompatible messages to each other. You create a new message type by creating an XML Schema using the BizTalk Schema Designer in Visual Studio. You don't have to know a lot about XML or XML Schemas to be able to create a schema since BizTalk allows you to describe the schema and then handles the details of generating the type descriptions for you. Type safety is among BizTalk Server's more visible features because it plays a key role in the operations of the underlying publish-subscribe system. Take the time to understand type safety instead of trying to work around it - your solutions will be more robust and easier to manage. |
"The number of computer science majors enrolled at U.S. universities increased for the first time in six years..." |