Title: Introduction to XML, SOAP and Biztalk
1Introduction to XML, SOAP and Biztalk
Arie Leeuwesteijn ariele_at_microsoft.com
2Content
- XML use cases
- What is XML ?
- XML syntax
- Document definitions and validation
- XML parsers
- XSL translations
- SOAP, a.k.a. Web Services
- Biztalk overview
3Objectives
- Reading XML documents
- Understanding XML terminology and acronyms
- Examples of XML applications
4XML Use Cases
- Application integration
- Generic format for data transfer for E-commerce
and other web applications - Storing and accessing structured data
5Application Integration
- High costs and effort because application data is
- Proprietary
- Incompatible
- Undocumented legacy data
- Different data formats
6Same data, different format
15
?
???
0x0F
fifteen
15.00
XV
1111
0001 0101
7The Internet
- The ultimate integration environment
- Many different systems and platforms
- Time to market measured in internet time
- Today XML is already integrated in
- Operating systems
- Applications
- Databases
- Development tools
- Browsers
8XML design goals
- Flexible, extensible and support for wide variety
of applications - Must be simple and light weight
- Straightforwardly usable over the internet
9What is XML?
- Meta language for self describing structured data
- Consists of data and tags
- Extensible language, users can define their own
specific tags - Version 1.0 specification approved by W3C as
recommendation
10XML History
- Subset of Standard Generalized Markup Language
(SGML) - Far less complex
- 20 of SGML features
- 80 of SGML functionality
- (XML spec is 26 pages, SGML 500)
11XML vs. HTML
- XML
- Subset of SGML
- Extensible
- Focus on data
- HTML
- SGML application
- Fixed
- Focus on presentation
12XML Document Structure
XML declaration (processing instructions)
lt!DOCTYPE name gt
Document definition (optional)
ltdoc_root_elementgt ltdata_elementgt
lt/data_elementgt lt/doc_root_elementgt
Document data
13Basic XML syntax
- Human readable text
- Support for Unicode character set
- Syntax is stricter than for example HTML
14Tags And Data
- Document consists of data marked up by tags
- Tags describe meaning and structure of data
- An element is a group of start-tag/end-tag with
the data in between - ltBookgtEssential XMLlt/Bookgt
Start-tag
End-tag
Data
15Start- and End-Tags
- Element must have a matching start- and
end-tagltonegthellolt/onegtlttwogtworldlt/twogt
?ltonegthello lttwogtworldlt/twogt ? - Empty elements can be written as
- lttaggtlt/taggt ?
- lttag/gt ?
- Tags are case sensitive
16XML Basic Syntax
- XML elements can have nested child elements to
structure to structure document in levels - ltoutergt ? ltinnergttextlt/innergtlt/outergtltoute
rgt ? - ltinnergtlt/outergtlt/innergt
17Root element
- A XML document must have one root element
- ltlibrarygt ? ltbookgtXML in
actionlt/bookgt ltbookgtEssential XMLlt/bookgtlt/
library gt - lt book gt XML in action lt/ book gt ?lt book gt
Essential XML lt/ book gt - What is the document root ?
18Comments
- Syntax for comments islt! -- This is a comment
--gt - Comments be placed everywhere in the document
except inside element tagslttag lt!-- comment
--gt gt ?
19Attributes
- Attributes associate named values to an element
- Attributes are part of the start-tag
- ltpublication typebookgt
- lttitlegtXML in actionlt/titlegt
- ltprice currencyUSDgt49.99lt/pricegt
- lt/ publication gt
- Values must be double or single quoted
20XML Example
- lt?xml version1.0 encodingUTF-8 ?gt
- ltlibrarygt
- ltbookgt
- lttitlegtXML in actionlt/titlegt
- ltprice currencyUSDgt49.99lt/pricegt ltisbngt0-735
6-0562-9lt/isbngt - ltrating scale5gt3lt/ratinggt
- lt/bookgt
- ltbookgt
- lttitlegtEssentail XMLlt/titlegt
- ltprice currencyUSDgt34.95lt/pricegt ltisbngt0-201
-70914-7lt/isbngt - ltrating scale5gt4lt/ratinggt
- lt/bookgt
- lt/ library gt
21Valid vs. Well Formed XML
- Well formedValid XML syntax
- Valid documentContent of document valid conform
specification of document - A valid document is automatically a well formed
document - A well formed document is not always a valid
document
22Document specifications
- Describes structure and contents of XML document
- Parsers can use schemas to validate a document
- Validation is optional
- Think if/where validation should take place
- Document Type Definitions (DTD), part of XML 1.0
standard
23DTD example
lt?xml version1.0?gt lt!DOCTYPE CATALOG
lt!ELEMENT BOOK (TITLE, PRICE)gt lt!ELEMENT
TITLE(PCDATA)gt lt!ELEMENT PRICE(PCDATA) gt lt
CATALOG gt ltBOOKgt ltTITLEgtXML in
actionlt/TITLEgt ltPRICEgt49.95lt/PRICEgt
lt/BOOKgt lt/ CATALOG gt
24DTD Issues
- Good DTDs are difficult to write (Extended
Backus Naur Form notation) - DTDs are not extensible and many limitations
- Most important limitation is lack of data types
25XML Schemas
- Alternative for DTDs
- XML is used to describe the structure of the
document, no need to learn new language or use
other tools - Lifts most limitations of DTDs (data types )
- XSD,
- XML schema specification
- W3C recommendation
- XDR
- Early MS version of XSD
26XML-Data Schemas simple example
- ltSchema gtltElementType nametitle"
content"textOnlygt - ltElementType nameisbn" content"textOnly/gt
- ltElementType namebook" content"eltOnly"gt
- ltelement typetitle"/gt ltelement typeisbn"/gt
lt/ElementTypegt - lt/Schemagt
27XML Parsers
- Parse XML document
- Validate XML syntax (always)
- Validate content (optional)
- Access data
- Update data
- Translate data (XSL)
28XML Parser types
- Two different parser models
- Document Object Model (DOM)
- Complete document in memory
- Easy access for applications
- Queries on data
- Translations
- Simple API for XML (SAX)
- Generates event per parsed element
- Large documents
- Batch processing
- More difficult to use than DOM
29Document Object Model
- DOM defines logical structure of a parsed XML
document - DOM defines how data can be accessed and
manipulated - Provides standardized API (level 1, 2 and 3)
- DOM can also be used to create or modify XML
documents
30Document Object Model
document
A node can contain child nodes or text
root node
Node lists
node
node
node
node
node
node
node
31Querying the DOM through XPath
- XPath declarative language for locating nodes and
fragments in XML trees - Allow you to locate nodes by
- Absolute or relative position
- Element or attribute types
- Element or attribute values
- Combinations using boolean operators
- Also used in XSL, XPointer and XLink
specifications
32XPath examples
- All books in the current contextbook (equal to
./book) - All books anywhere in the document//book
- All books with specified element
valuebooktitleEssential XML - or a specified attribute valuebook_at_typepaperba
ck - or just having the attributebook_at_type
- The first 3 booksbookindex()lt4
33Extended Stylesheet Language XSL
- Similarities with CSS, but more powerful
- Applies translations to data that matches a
pattern - Close to becoming a standard (draft status W3C)
34XSL translations
- XSLT is based on pattern matching and templates
- A template rule consist of a pattern and a
template - Processor finds best matching pattern and applies
related template for translation
35XSL stylesheet example
lt?xml-stylesheet type"text/xsl
hrefbooks.xsl"?gt ltbooksgt ltbookgtlttitlegtEssent
ial XMLlt/titlegtlt/bookgt ltbookgtlttitlegtXML in
actionlt/titlegtlt/bookgtlt/booksgt
XML Data
ltxslstylesheet.gt ltxsl-template
matchtitlegt lttrgtlttdgtltbgtltxsl-value-of
selecttext()/gtlt/tdgtlt/trgtlt/xslstylesheetgt
XSLstyle sheet (partial)
HTML output
lttrgtlttdgtltbgtEssential XMLlt/tdgtlt/trgtlttrgtlttdgtltbgtXML
in actionlt/tdgtlt/trgt
36XSL usage
- Formatting and displaying XML data as HTML, PDF,
etc. - Converting XML document
- Other XML document structures (XML-gtXML)
- Other data formats (CSV, Edifact)
- MS Biztalk mapping editor generate XLS to convert
XML, Flat file and Edifact documents to XML and
back.
37XML Applications
- XML in real applications
- Simple Object Access Protocol
- Microsoft Biztalk 2000
- Note this is not a training on SOAP and Biztalk
38Software integration
- Todays middleware
- Vendor and language depended
- COM v.s. EJB
- Interoperability problems
- Was not designed to use over the internet
- Reliable communications
- Firewalls
- Complex
39SOAP
- Simple Object Access Protocol
- Invoking object methods using XML and HTTP
- Specification written by Microsoft, IBM, Software
and Developmentor - Vendor and middleware independency (the end of
middleware battles ?) - Supported and available today from most major
vendors (MS,IBM,IONA etc.) - Core technology in Microsoft .NET web services
40SOAP
This whole process is transparent for client and
component
41Simple SOAP Request
POST /StockQuote HTTP/1.1 Host
www.stockquoteserver.com Content-Type text/xml
charset"utf-8 Content-Length 323 SOAPAction
Some-Namespace-URIGetLastTradePrice
ltSQEnvelope xmlns SOAP "http//schemas.xmlsoa
p.org/soap/envelope/" SQ encodingStyle"http//
schemas.xmlsoap.org/soap/encoding/gt lt SQ
Bodygt ltmGetLastTradePrice xmlnsm"Some-Names
pace-URI"gt ltsymbolgtMSFTlt/symbolgt
lt/mGetLastTradePricegt lt/ SQ Bodygt lt/ SQ
Envelopegt
HTTP headers
Body
GetLastTradePrice(MSFT)
Envelope
42Simple SOAP Response
HTTP headers
HTTP/1.1 200 OKContent-Type text/xml
charset"utf-8Content-Length
nnnn ltSPEnvelopexmlnsSP"http//schemas.xmlsoap
.org/soap/envelope/"SPencodingStyle"http//sche
mas.xmlsoap.org/soap/encoding/"gt ltSPBodygt
ltmGetLastTradePriceResponse xmlnsm"Some-Names
pace-URI"gt ltPricegt160.95lt/Pricegt
lt/mGetLastTradePriceResponsegt
lt/SPBodygt lt/SPEnvelopegt
Body
Result
Envelope
43What Is Biztalk ?
- Biztalk Community (Biztalk.org)
- Library for business document specification
- Stimulate reuse
- Submit and retrieve document specifications
- 400 third-party XML business documents
- 150 registered organizations
- Biztalk Framework
- XML Specification for document routing and
exchange (SOAP 1.1 compliant) - Biztalk Server
- Microsoft server product for processing,
transforming, signing, routing of documents
44B2B challenges
Customers
Suppliers
My company
45Business to Business
- Different data format (EDI, CSV, XML)
- Different document structures
- Different protocols
- Different encryption technologies
- Different operating systems
- Legacy ERP and other back office systems
46Biztalk Server
- Design time tools
- Schema, transformation definition
- Document processing server
- Messaging
- Communication
- Transformation
- Routing
- Encryption
- Workflow
- Orchestration
47XML in Biztalk
48XML in Biztalk
Visio Diagram
Compile
XLANG schedule
Scheduler
Applications
XLANG Runtime
Biztalk Messaging
49XML in Biztalk Server
- XML for describing all in- and outbound business
documents as an extended Data-Schema - XSL for document translations
- XML as internal format for all processed
documents - XLANG workflow schedules
50Biztalk demos
- Biztalk Editor
- Biztalk Mapper
- Biztalk Orchestration
51Things to read
- XML in ActionMS-PressISBN 0735605629
Professional XMLWROXISBN 1861003110
Understanding SOAPSAMSISBN 0672319225
Essential XMLAddison WesleyISBN 0201709147
52Places to go
- http//www.w3c.org (all mentioned standards)
- http//msdn.microsoft.com/xml (tutorials and
reference on xml) - http//msdn.microsoft.com/soap(tutorials and
reference on xml) - http//www.biztalk.org
- (Biztalk organization)
53ltQUESTIONS/gt
54Biztalk Orchestration
55Biztalk Editor
56Biztalk Mapper