Upload
mateo-oliver
View
238
Download
1
Embed Size (px)
Citation preview
Module 2:Creating Schemas
Overview
Lesson 1: Introduction to BizTalk Schemas
Lesson 2: Creating XML and Flat File Schemas
Lesson 1: Introduction to BizTalk Schemas
Reviewing XML Terminology
What Are XML Namespaces?
How Does BizTalk Use XML Namespaces?
What Is a BizTalk XML Schema?
Supported BizTalk Schema Types
Flat File Structures
XML StandardsXML Standards
Reviewing XML Terminology
Elements
Attributes
Namespaces in XML
XML Schema (XSD)
XML Path Language (XPath)
Extensible Stylesheet Language Transformations (XSLT)
Document Object Model (DOM)
SOAP
Web Services Description Language (WSDL)
Elements
Attributes
Namespaces in XML
XML Schema (XSD)
XML Path Language (XPath)
Extensible Stylesheet Language Transformations (XSLT)
Document Object Model (DOM)
SOAP
Web Services Description Language (WSDL)
<salesReport> <customer id="Fabrikam"> <sales> <id>widget1004</id> <unitsSold>100</unitsSold> <price currency="USD">35</price> </sales> </customer></salesReport>
<salesReport> <customer id="Fabrikam"> <sales> <id>widget1004</id> <unitsSold>100</unitsSold> <price currency="USD">35</price> </sales> </customer></salesReport>
<salesReport xmlns="http://adventure-works.com/salesReport"> <customer id="Fabrikam"> <sales> <id>widget1004</id> <unitsSold>100</unitsSold> <price currency="USD">35</price> </sales> </customer></salesReport>
<salesReport xmlns="http://adventure-works.com/salesReport"> <customer id="Fabrikam"> <sales> <id>widget1004</id> <unitsSold>100</unitsSold> <price currency="USD">35</price> </sales> </customer></salesReport>
<salesReport xmlns="http://adventure-works.com/salesReport" xmlns:prod="http://adventure-works.com/products"> <customer id="Fabrikam"> <sales> <id>widget1004</id> <unitsSold>100</unitsSold> <price currency="USD">35</price> </sales> </customer></salesReport>
<salesReport xmlns="http://adventure-works.com/salesReport" xmlns:prod="http://adventure-works.com/products"> <customer id="Fabrikam"> <sales> <id>widget1004</id> <unitsSold>100</unitsSold> <price currency="USD">35</price> </sales> </customer></salesReport>
<salesReport xmlns="http://adventure-works.com/salesReport" xmlns:prod="http://adventure-works.com/products"> <customer id="Fabrikam"> <sales> <prod:id>widget1004</prod:id> <prod:unitsSold>100</prod:unitsSold> <prod:price prod:currency="USD">35</prod:price> </sales> </customer></salesReport>
<salesReport xmlns="http://adventure-works.com/salesReport" xmlns:prod="http://adventure-works.com/products"> <customer id="Fabrikam"> <sales> <prod:id>widget1004</prod:id> <prod:unitsSold>100</prod:unitsSold> <prod:price prod:currency="USD">35</prod:price> </sales> </customer></salesReport>
NamespacesNamespaces
What Are XML Namespaces?
Provide unique names for elements and attributes
Prevent naming conflicts with other schemas
Use the xmlns attribute to declare the namespace the element belongs to
A prefix is added to the declaration to remove ambiguity
Provide unique names for elements and attributes
Prevent naming conflicts with other schemas
Use the xmlns attribute to declare the namespace the element belongs to
A prefix is added to the declaration to remove ambiguity
BizTalk Server
How Does BizTalk Use XML Namespaces?
Schema ATargetNamespace=“NewOrders”
Schema BTargetNamespace=“OrdersUpdate”
Message ATargetNamespace=“NewOrders”
Message ATargetNamespace=“NewOrders”
Message BTargetNamespace=“OrderUpdate”
Message BTargetNamespace=“OrderUpdate”
Message CTargetNamespace=“Inventory”
Message CTargetNamespace=“Inventory”
No Match
What Is a BizTalk XML Schema?
BizTalk uses the XML schema definition language (XSD)
<xs:schema targetNamespace="http://contoso.com/invoice" xmlns:xs=“http://www.w3.org/2001/XMLSchema”>
</xs:schema>
<xs:schema targetNamespace="http://contoso.com/invoice" xmlns:xs=“http://www.w3.org/2001/XMLSchema”>
</xs:schema>
<xs:schema targetNamespace="http://contoso.com/invoice" xmlns:xs=“http://www.w3.org/2001/XMLSchema” attributeFormDefault="unqualified“ elementFormDefault="qualified">
</xs:schema>
<xs:schema targetNamespace="http://contoso.com/invoice" xmlns:xs=“http://www.w3.org/2001/XMLSchema” attributeFormDefault="unqualified“ elementFormDefault="qualified">
</xs:schema>
<xs:schema targetNamespace="http://contoso.com/invoice" xmlns:xs=“http://www.w3.org/2001/XMLSchema” attributeFormDefault="unqualified“ elementFormDefault="qualified"> <xs:element name="Item">
</xs:element></xs:schema>
<xs:schema targetNamespace="http://contoso.com/invoice" xmlns:xs=“http://www.w3.org/2001/XMLSchema” attributeFormDefault="unqualified“ elementFormDefault="qualified"> <xs:element name="Item">
</xs:element></xs:schema>
<xs:schema targetNamespace="http://contoso.com/invoice" xmlns:xs=“http://www.w3.org/2001/XMLSchema” attributeFormDefault="unqualified“ elementFormDefault="qualified"> <xs:element name="Item"> <xs:complexType> <xs:sequence>
</xs:sequence> </xs:complexType> </xs:element></xs:schema>
<xs:schema targetNamespace="http://contoso.com/invoice" xmlns:xs=“http://www.w3.org/2001/XMLSchema” attributeFormDefault="unqualified“ elementFormDefault="qualified"> <xs:element name="Item"> <xs:complexType> <xs:sequence>
</xs:sequence> </xs:complexType> </xs:element></xs:schema>
<xs:schema targetNamespace="http://contoso.com/invoice" xmlns:xs=“http://www.w3.org/2001/XMLSchema” attributeFormDefault="unqualified“ elementFormDefault="qualified"> <xs:element name="Item"> <xs:complexType> <xs:sequence> <xs:element name="Description" type="xs:string" /> <xs:element name="Quantity" type="xs:integer" /> <xs:element name="UnitPrice" type="xs:decimal" /> <xs:element name="ItemID" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:element></xs:schema>
<xs:schema targetNamespace="http://contoso.com/invoice" xmlns:xs=“http://www.w3.org/2001/XMLSchema” attributeFormDefault="unqualified“ elementFormDefault="qualified"> <xs:element name="Item"> <xs:complexType> <xs:sequence> <xs:element name="Description" type="xs:string" /> <xs:element name="Quantity" type="xs:integer" /> <xs:element name="UnitPrice" type="xs:decimal" /> <xs:element name="ItemID" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:element></xs:schema> <!-- XML Instance -->
<Item xmlns="http://contoso.com/invoice"> <Description>Widget</Description> <Quantity>10</Quantity> <UnitPrice>1.04</UnitPrice> <ItemID>A1234</ItemID></Item>
<!-- XML Instance -->
<Item xmlns="http://contoso.com/invoice"> <Description>Widget</Description> <Quantity>10</Quantity> <UnitPrice>1.04</UnitPrice> <ItemID>A1234</ItemID></Item>
Supported BizTalk Schema Types
Message Type DetailsXML
Supports native XML message typesDefined in XML Schema definition language (XSD)
Flat FileSupports delimited or positional file formatsXML tags used to represent valuesTag information stored using the annotation capabilities of XSD
EDISpecially formatted text message BizTalk supports EDIFACT and X12 formatsXSD annotations used to define format
Node Structure Start Length
Description Delimited 0 50
UnitPrice Delimited 50 10
Quantity Delimited 60 10
TotalPrice Delimited 70 10ItemID Delimited 80 10Status Delimited 99 1
UnitPrice
ItemDescriptionQuantity
TotalPriceItemID
Status
ISA:00: :00: :01:1515151515 :01:515151 :041201:1217:U:00403:000032123:0:P:*~GS:CT:9988776655:1122334455:20041201:1217:128:X:004030~ST:831:00128001~BGN:00:88200001:20041201~N9:BT:88200001~TRN:1:88200001~AMT:2:10
Flat File Structures
Delimited flat filesDelimited flat files
Fields separated by a specified delimiter
Have a common end-of-record terminator
Fields separated by a specified delimiter
Have a common end-of-record terminator
John, Smith, 123 Main St., “Learning BizTalk Server 2010”John, Smith, 123 Main St., “Learning BizTalk Server 2010”
Positional flat filesPositional flat files
Fields are fixed length
Have a common end-of-record terminator
Fields are fixed length
Have a common end-of-record terminator
John Smith 123 Main St. Learning BizTalk Server 2010John Smith 123 Main St. Learning BizTalk Server 2010
Lesson 2: Creating XML and Flat File Schemas
Methods for Creating BizTalk XML Schemas
Generating Schemas
Creating a Schema by Using the BizTalk Editor
Using Multiple Schemas
Testing a Schema
Demonstration: Creating and Testing a Schema
Using the Flat File Schema Wizard
Demonstration: Creating and Testing a Flat File Schema
Building a BizTalk Project
Methods for Creating BizTalk XML Schemas
Schema creation methodsSchema creation methods
Create from scratch using BizTalk Editor
Import or include existing types
Generate from an instance message
Migrate an older XDR schema to an XSD schema
Create from scratch using BizTalk Editor
Import or include existing types
Generate from an instance message
Migrate an older XDR schema to an XSD schema
Schema creation methodsSchema creation methods
XDR schema
DTD
A well-formed XML document
XDR schema
DTD
A well-formed XML document
Generating Schemas
Creating a Schema by Using the BizTalk Editor
XSD ViewXSD View
Schema Tree ViewSchema Tree View
Using Multiple Schemas
Method Usage
Import Accesses and uses types defined in the imported schemaProvides for using types from schemas in other namespaces
Include Accesses and uses types defined in the included schemaProvides for using types from schemas in the same namespace
Redefine Accesses and uses types defined in the redefined schema Provides for using types derived from a schema in the same namespace
Purchase Order
Date
Company
City
Ship ToContact
State
Zip
Unit Cost
ItemPart Number
Description
Weight
Testing a Schema
Create XML Create XML
Validate XSD Validate XSD
Validate XML Validate XML
Demonstration: Creating and Testing a Schema
In this demonstration, you will see how to:
Use the BizTalk Editor to createa schema
Validate and test a schema
Flat File Schema WizardFlat File Schema Wizard
Using the Flat File Schema Wizard
Graphical tool for defining flat file schemasCan define schemas for delimited or positional flat files
Graphical tool for defining flat file schemasCan define schemas for delimited or positional flat files
Demonstration: Creating and Testing a Flat File Schema
In this demonstration, you will see how to:
Create a schema by using theFlat File Schema Wizard
Validate and test a flat file schema
Building a BizTalk Project
Building a projectBuilding a project
Compiles the project items (schemas, maps, orchestrations, pipelines)Creates an assembly (DLL file) Stores the assembly in the project subfolder (…\bin\Development)Displays any errors or warnings in the task list
Compiles the project items (schemas, maps, orchestrations, pipelines)Creates an assembly (DLL file) Stores the assembly in the project subfolder (…\bin\Development)Displays any errors or warnings in the task list
Compile
Build Project Build Project
.NETAssembly
.DLL
BizTalk ProjectBizTalk Project
XSD Schema
Lab: Creating and Configuring BizTalk Schemas
Exercise 1: Creating a New BizTalk Project
Exercise 2: Creating an XML Schema
Exercise 3: Creating a Flat File Schema
Exercise 4: Generating a Schema from an XML Message Instance