Total Pageviews

Saturday, June 25, 2016

What are the different types of BizTalk Schema

SCHEMA IN BIZTALK

What is BizTalk Schema?

BizTalk is an integration technology and it basically connects different partner. Now different partner can send the message in different format. E.g. one partner can send the message in JSON format and receiver can accept the flat file. However BizTalk understand only xml format and if partners are using another format than first it needs to be converted to xml format. 
                In order to understand the xml format by BizTalk, we need to define the structure of the xml message. E.g. what will be the root node name, what will be the elements name, its data type, attributes name , structure of the message (which element will fall under which node) etc.  Schema does this work for BizTalk. Schema defines the structure of the messages which are being received in BizTalk and sent to partner. BizTalk uses XML Schema Definitions (XSDs) to describe the xml message. There are 4 types of schema in BizTalk.

1)      XML Schema
2)      Flat file Schema
3)      Envelope Schema
4)      Property Schema

XML Schema:
 If BizTalk has to receive an xml message then the schema which defines the structure of this xml message is called as xml schema.

e.g. below is the xml messages





Corresponding xml schema in BizTalk looks like this.



We can see here the schema is defining the xml messages, name of the elements their data types.

There are several properties of the schema which needs to be set like targetnamespace etc.

Flat file Schema: 
If BizTalk has to receive or send flat files then schema generated to define the structure of the flat file is called Flat file schema.

e.g below is the  flat file which contains only first name and last name of student which is comma separated.



Corresponding Flat File Schema generated in BizTalk looks like this.



Annotation tag is being added in schema to define the flat file schema. Legacy system uses the flat file schema and now a day’s most of the system uses either xml or JSON or EDI format for business. The flat file specification should be thoroughly agreed between businesses partners before developing the schema, small change in flat file can lead to large rework from development prospective.

Envelope Schema:
If partner wants to send more than one message having same structure in one shot e.g. partner wants to send the multiple student details in one message then we call that message as Envelope. In BizTalk we can de batch the Envelope message and send one message at a time to BizTalk.This can be achieved by envelop schema.  In order to create the envelope schema we need to set some schema property. Envelope property needs to be set to true and in Body xpath expression, need to provide body path of the document which is repeating structure. Both Flat file and Xml Schema can be treated as envelop schema and we can set property once double click on the schema and see property.




Generally the repeating node is Record.


Property Schema:
To understand the property schema, first we should know what property promotion is. Suppose we are receiving and xml message having student percentage and based on percentage we want to route the message to different department. In such cases we can promote the age from the message. The Age coming from xml instance messages is coming as content of the message. In order to route the message based on age, this property should be present in context of the message. Moving the content of message to context is called the property promotion and when we do so the promoted element is added to one Schema which takes care to move the values from content to context. This schema is called property schema.







Apart from these Schemas there is one more type of schema which is called as EDI Schema. Actually it is same as Flat File Schema , but considering the complexity of the EDI messages ,BizTalk provides around 8000+ EDI schemas and we can use them instead of generating on own.


To Read about Canonical Schema click here.




2 comments: