Creating BizTalk Schemas

  • Introduction to BizTalk Schemas
  • Schema types
  • Creating Schemas from XML files
  • Creating Schemas for flat files
  • Creating Schemas from JSON files
  • Creating Schema from Excel file

Introduction to BizTalk Schemas:

In integration there is one of the important points is message format. This should be agreed in between source system & destination system and message format will not be change. BizTalk has Schemas in xsd format to validate the source system message and send the message to destination system in agreed message format.

 Schemas describe the structure of messages that are to be sent back and forth between BizTalk and the system BizTalk is exchanging the message with.

Based on schemas BizTalk generate a Message Type. Based on message type BizTalk Message Box database specify which orchestration or send port should receive the published message.

BizTalk Schema Types:

When we start any BizTalk project to development. There are the following schemas shows in Visual studio when Launch Schema wizard.

Below are the details of schemas:

  1. Flat File Schema: This schema is basically used for csv or flat file message. For flat file there are two types of message. Position or delimiter based. As we know BizTalk process message only in xml format. So, in this case BizTalk stored all the flat files details in Annotation section of schema when it is generated. BizTalk has flat file schema wizard which make easy to create schema from flat file or csv files
  2. Property Schema:  Property Schema in BizTalk is usually about taking values from incoming message and moving them into the context of the message, so they are easily accessible and usable for routing. A property schema is a simple version of a BizTalk schema that plays a role in the process of copying promoted properties back and forth between the instance message and the message context. this schema specifies an unstructured collection of fields into which you can promote fields from within an instance message defined by a schema associated with your property schema. Promoted properties are persisted to the Message box database. The Message box generate a large join in SQL Server each time a message is published, which is basically a join between the Context of Message, the possible properties, and the properties of all subscribers. So, the no. of Promoted Properties should be kept minimum
  3. Schema: This is basically xml schema. An XML schema describes a business document that is represented in XML. Because Microsoft BizTalk Server uses XML as its canonical representation for business documents, inbound and outbound documents do not require any translation.
  4. Flat file Schema Wizard: This wizard is basically used to make easy to create schema from flat or csv files. It provides simple steps to create schema based on position of flat files or delimiter e.g. (, or ;).The BizTalk Flat File Schema Wizard is designed to simplify the process of creating flat file schemas by providing the following:
  • The ability to use flat file instances as input
  • A visual design surface for working with delimited and positional flat file schemas
  • An interactive wizard-based process for adding elements to the schema and defining flat file related annotations.
  • Link to create schema based on flat file document

5. JSON Schema Wizard:  From BizTalk 2013 R2, BizTalk also support JSON file messaging. BizTalk has JSON schema wizard which is basically used for converting json message into xml message.

Creating Schema:

BizTalk provides mechanism to create schema from wizard. If you have sample files in xml, json, flat, or csv, then BizTalk have its own wizard to create the schema easy and fast. If you don’t have then you can create manually also as defined in above section.

Below is the list of procedure to create schema based on sample message.

Schema from xml files:

If you have xml file and want to create schema based on xml file. Then right click on project->Add-> Add Generated Items

Select Generate Schemas

Click Add

Select Well-Formed XML and select xml file in Input file as above window

It will create schema.

When you work on first time, it asks to install below vbs file before creating the schema.

C:\Program Files (x86)\Microsoft BizTalk Server 2016\SDK\Utilities\Schema Generator\InstallWFX.vbs

Open commond prompt and run following command

cscript “C:\Program Files (x86)\Microsoft BizTalk Server 2016\SDK\Utilities\Schema Generator\InstallWFX.vbs

Schema from flat or csv files:

Below are some links for creation of schema based on flat file:

https://docs.microsoft.com/en-us/biztalk/core/how-to-use-biztalk-flat-file-schema-wizard

https://docs.microsoft.com/en-us/biztalk/core/walkthrough-creating-a-flat-file-schema-from-a-document-instance

https://www.c-sharpcorner.com/UploadFile/john_charles/biztalk-messaging-services-flat-file-schema/

Create Schema from Json files:

From BizTalk 2013 R2 BizTalk also provide inbuild REST service capability. Before this this was required custom coding for Json file and rest services. Now its easy to create schema from Json file.

Select json file in instance file and change the root node name and click finished. It will create schema.

Create Schema from Excel file or from other files:

Sometime in project requirement, files are not available in xml text or json file format. files are some other file format e.g. excel or pdf. And it requires to process via BizTalk. BizTalk don’t have capability to convert all other types of message to xml file by default. So, BizTalk provide facility to convert file into xml via custom code in pipeline via custom pipeline. Below is one of the examples how to process excel files into BizTalk.

https://vkbiztalk.com/2018/04/27/biztalk-custom-pipeline-to-convert-excel-file-to-flat-file/

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