Welcome to BARMAGY Sign in | Join | Help

BizTalk - The way I see it! – Part 4: Developing Schemas

 

Today, I’ll talk about how to develop Schemas using BizTalk, if you don’t know what a schema is, kindly use this link.

 

As a prerequisite, you must install the following software in order to develop BizTalk Applications:

·         Microsoft Visual Studio (2003 or higher)

·         Microsoft BizTalk Server 2006 (preferably R2), and its prerequisites

 

After you install BizTalk, Kindly walk with me thru the following steps:

1.       Open Visual Studio

2.       In the new Project window, you should see something similar to this

3.       After selecting “Empty BizTalk Server Project” from templates pane, write a descriptive name of the new project, let’s say, “BizTalkTraining.OneBigApplication

4.       Next step is to create some folders inside the newly created project, as the following

This step is not mandatory; however, creating these folders will help you with the namespaces and target namespaces.

5.       To create a new Schema, right-click the Schemas folder and say Add - new Item

6.       In the Add New Item window, choose Schema, and type the name of the new Schema, let’s Say “Order

7.       Now, you should see the BizTalk Schema Editor,

 

Just a reminder: we’re in the process of creating a new schema that should describe -at the runtime- the shape of an XML document

 

8.       Consider the following XML, we need to create our schema to match this XML

<Order>

                <OrderID>123</OrderID>

                <OrderAmount>10.1</OrderAmount>

                <Products>

                                <Product ProductID=”456”>

                                                <ProductName>Xyz</ProductName>

                                </Product>

                </Products>

</Order>

By examining this XML, we should have the following elements to create the schema:

·         One root element, named Order, under this root we’ll have:

o   Element named OrderID

o   Element named OrderAmount

o   Record named Products, and under this,

§  Record named product, under this

·         Attribute named ProductID,

·         Element named ProductName

 

9.       Going back to our XSD editor, we will do the following to form the new schema

a.       Rename the Root element to be Order

b.      Right-click Order node, and say Insert Schema Node – Child Field Element,

c.       Rename the new field element to be OrderID

d.      Repeat the same step for OrderAmount (Child Field Element), Products (Child Record),

e.      Now, r-click the Products node, and add a new Child Record, rename it to Product

f.        On Product, add a new Child Field Attribute named ProductID, and a new Child Field Element named ProductName

10.   While clicking any of these nodes, like OrderAmount for example, notice the properties window in Visual Studio and how it changes from element to another.

11.   Now you can generate an instance of this XSD

Check the VS output window to see the new instance.

As you can see in the context menu above, you can also validate the schema, or even validate the instance against this schema.

 

Quick Tip: if you have already an XML file that you want to create a schema for, you can “Add Generated Items” found under Add when right clicking the project (or any folder)

 

If you are new to BizTalk development, I urge you to exercise and discover more inside BizTalk schema editor. It has a lot of features that cannot be covered in a single blog post!

 

See you next time with “Developing Maps using BizTalk”

 

Published Friday, May 02, 2008 11:04 AM by Mika

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

What do you think?

(required) 
required 
(required)