SUB Gottingen 7 217 837 719 2005 A 8738 XML and Web Services Ron Schmelzer et al. SAMS
SUB Gottingen 7217 837 719
2005 A 8738
XML and WebServices
Ron Schmelzer et al.
SAMS
ContentsIntroduction 1
Who This Book's Intended Audience Is 1What You Need to Know Prior to Reading This Book 1What You Will Learn from Reading This Book 2What Software You Will Need to Complete the Examples Provided
with This Book 2How This Book Is Organized 2What's on the Sams Web Site for This Book 4Conventions Used in This Book 4
PART I Essentials of XML 5
1 XML in Context 7XML: A Brief Glimpse 9The Time Is Right 9How We Got Here 11
Standard Generalized Markup Language (SGML) 11Hypertext Markup Language (HTML) 15Electronic Data Interchange 16
The Beginnings of XML 19The Promise of XML 20
Benefits of XML 20Advantages of XML over SGML 23Advantages of XML over HTML 23Advantages of XML over EDI 24Advantages of XML over Databases and Flat Files 25Drawbacks to XML 26XML-Based Standards 27
Where Is XML Heading? 28E-Business and E-Commerce 28Content Management 29Web Services and Distributed Computing 30Peer-to-Peer Networking and Instant Messaging 31Getting More Meaning out of the Web: The Semantic Web 32
Summary 33
XML and Web ServicesVI
UNLEASHED
2 The Fundamentals of XML 35Introduction to XML Syntax 36
Markup Languages and Self-Describing Data 37A Simple XML Document 38
XML Document Structure 39XML Declaration 40Document Type Declaration 41Markup and Content 43Elements 43Attributes 45Entity References 47Comments 48Processing Instructions 49Marked CDATA Sections 49Document Type Definitions 50XML Content 50
XML Content Models 51Handling Whitespace in XML 52
Rules of XML Structure 53All XML Elements Must Have a Closing Tag 53XML Tags Are Case Sensitive 54All XML Elements Must Have Proper Nesting 54All XML Documents Must Contain a Single Root Element 54Attribute Values Must Be Quoted 55Attributes May Only Appear Once in the Same Start Tag 55Attribute Values Cannot Contain References to External
Entities 56All Entities Except amp, It , gt, apos, and quot Must Be
Declared Before They Are Used ...56Other Rules of XML Structure .56
Well-Formed and Valid Documents 56Well-Formed Documents 56Valid Documents 57
Linking XML Documents Together 57Namespaces in XML 58
Declaring Namespaces 60Identifying the Scope of Namespaces 61
Applying Style to XML 61Basics of Reading and Processing XML 62
Parsers 62The Document Object Model (DOM) 64The SAX API 64
— VIICONTENTS
International Language Support in XML 65Unicode 65
Summary 66
3 Validating XML with the Document Type Definition (DTD) 67Document Type Definitions 68Some Simple DTD Examples 70Structure of a Document Type Definition 72
The Document Type Declaration 72DTD Attributes 85DTD Entities 92More DTD Directives 101
DTD Drawbacks and Alternatives 103Summary 105
4 Creating XML Schemas 107Introduction to the W3C XML Schema Recommendation 108
Sample XML Document 109Schema for XML Document 112
Creating XML Schemas 116Declaring Attributes 118Declaring Elements 125Declaring Complex Elements 128Declaring Simple Types 130Refining Simple Types Using Facets 131Anonymous Type Declarations 138Specifying Mixed Content for Elements 140Annotating Schemas 141Model Groups 142Attribute Groups 148Targeting Namespaces 149"Inheriting" from Other Schemas 159
Summary 168
5 The X-Files: XPath, XPointer, and XLink 169XPath 171
Operators and Special Characters 171XPath Syntax 172
XPointer 207Points 209Ranges 213Abbreviating XPointer Notation 214
XML and Web ServicesV I I I
UNLEASHED
XLink 215Simple Links 219Extended Links 219
Summary 221
6 Defining XML Using Alternate Schema Representations 223A Brief Review of XML Schemas 224Dead Formats: XDR, DSD, and DCD 229
XML Data Reduced (XDR) Schema 230Document Structure Description (DSD) Schema 233Document Content Description (DCD) Schema 237
Schema for Object-Oriented XML (SOX) 240RELAX NG Schema 243
RELAX 244TREX 247Combining RELAX and TREX 249
Schematron 253Summary 262
PART II Building XML-Based Applications 265
7 Parsing XML Using Document Object Model 267What Is DOM, Anyway? 269What DOM Is Not 269Why Do I Need DOM? 270Disadvantages of Using DOM 270DOM Levels 271DOM Core 271
Parents, Children, and Siblings 272DOM Interfaces ...273Java Bindings 274Walking Through an XML Document 275Creating an XML Document 281
DOM Traversal and Range 284Traversal 284Range 288
Other DOM Implementations 291JDOM 291Small DOM-like Implementations 294
Java Architecture for XML Binding (JAXB) 294Data Binding 295JAXB Example 296
Summary 307
-z l x
CONTENTS
Parsing XML Using SAX 309What Is SAX, Anyway? 310What SAX Is Not 311Why Do I Need SAX? 311SAX vs. DOM 312Disadvantages 312SAX Versions 313SAX Basics 314
SAX Packages 314SAX Implementations 316
Working with SAX 317Walking Through an XML Document 317Validation 321Handling Errors 325Entity References 328Lexical Events 331
Summary 344
Transforming XML with XSL 345XSL Technologies 346XSLT for Document Publishing 347
Getting Started with XSLT 349The Missing Piece: The XSLT Processor 352Advanced Features of XSLT 360
XSL for Business-to-Business (B2B) Communication 371Creating the XSL Style Sheet 373Using the XSLT Processor 374Running the Example 376
XSL Formatting Objects 377XSL-FO Formatting Engines 377Basic Document Structure 379Generating a PDF Document 386Page Headers and Footers 387Graphics 390Tables 391
Web Application Integration: Java Servlets, XSLT, andXSL-FO 399
Developing the Java Servlet 400Testing the Example 403
Summary 403
XML and Web Services
UNLEASHED
10 Integrating XML with Databases 405XML Database Solutions 407
XML Database Mapping 407Native XML Support 408
Modeling Databases in XML 409JAXB Solution 410Reviewing the Database Schema 411Constructing the Desired XML Document 412Defining a Schema for the XML Document 413Creating the JAXB Binding Schema 414Generating the JAXB Classes Based on Schemas 416Developing a Data Access Object (DAO) 419Developing a Servlet for HTTP Access 429Testing the Application 432Converting the XML Data to HTML with XSLT 435Testing the JSP Page 437
Summary 437
11 Formatting XML for the Web 439A Brief History of DSSSL 440A Brief History of CSS 443XML Presentation Using CSS 448An Overview of XHTML 454
XHTML 1.0: The Transition 454XHTML 1.1: Modularization 470
An Overview of XForms 487Introduction to XForms 488Next Generation of Web Forms 488XForms: Three Layers 491Instance Data Tracking 493Rich Data Type and Form Validation 495Multiple Form Documents 496
Summary 497
12 Interactive Graphical Visualizations with SVG 499Vector Graphics to Complement Bitmap Graphics 500
Bitmap Graphics 501Vector Graphics 501Complementary Bitmap and Vector Graphics 503
SVG: An XML Standard for Vector Graphics 503The SVG Standard 504XML Technologies Related to SVG 504
— xiCONTENTS
Creating an Interactive Graphical Visualization 505Defining the Content DTD 507Creating the XML Content 508Creating an SVG Content Presentation Prototype 508SVG with Style Using CSS 512Defining the XSL to Transform XML Content to SVG
Presentation 516Powering Web Pages with SVG 519SVG-To-Go with XSL-FO 533
SVG Structure and Elements 536Structure 536Elements 536
Development Primer 541The Future of SVG 542
Direct Web Browser Support for SVG 542New SVG Applications 542Expanding the Scope of SVG 542
Summary 543
13 XML and Content Management 545What Is Web Content Management? 546What Are the Components of a Content-Management
Workflow? 547Content-Input Phase 547Content-Repository Phase 549Content-Delivery Phase 550
The Role of XML in Web Content Management 552XML to Integrate System Components 552XML-Based Application Components 552
WebDAV Document Creation 553The Role of WebDAV 553WebDAV-Enabled Authoring Environments 554WebDAV and XML 555
How to Design the XML Content Environment 556Reusable Document Objects 556XML Document Design Principles 556
The Role of Metadata (RDF and PRISM) in Web ContentManagement 557
What Is Metadata? 558About the Resource Description Framework 559About XMP 562About PRISM 562
XML and Web ServicesXII
UNLEASHED
Web Content Syndication with RSS and ICE 566RSS Content Syndication 567Content Syndication using ICE 577
Selecting a Content-Management Solution 588Is the Solution Standards Based? 589System Performance 589Can the System Scale? 589Cost of Implementation 589Ongoing Support 589
Summary 590
14 Architecting Web Services 591What Are Web Services? 592Business Motivations for Web Services 593
Managing Complexity and IT Costs 594Lingua Franca of B2B E-Commerce 594Global E-Marketplace Vision 595
Technical Motivations for Web Services 595Limitations of CORBA and DCOM 595Problems with Business Modeling 597Problems with Vendor Dependence 598Reuse and Integration Goals 599
The Service-Oriented Architecture (SOA) 600Flexibility of E-Business Services 601Lessons Learned from Object Orientation 602Key Functional Components 604Just In Time Integration 606Semantic Issues and Taxonomies 607Security and Quality of Service Issues 608Composition and Conversations 612
Architecting Web Services 616The Implementation Architectural View: The Web Services
Technology Stack 617The Logical Architectural View: Composition of Web
Services 620The Deployment Architectural View: From Application
Servers to Peer-to-Peer 624The Process Architectural View: Life in the Runtime 626
Summary 627
XIIICONTENTS
15 Web Services Building Blocks: SOAP 629
Introduction to SOAP 630Improved RPC 631Improved Interoperability 633Key Building Block for Web Services 633
Basic SOAP Syntax 634SOAP Message Structure and Namespaces 634SOAP Envelope Element 639SOAP Header Element 639SOAP Body Element 641Data Types 641Arrays 645Structs 647Faults 649
Sending SOAP messages 650SOAP and HTTP 651Header Extensions 653SOAP and SMTP 654
SOAP Implementations 655Microsoft SOAP Toolkit 656Apache SOAP 663Interoperability Issues 666
The Future of SOAP 668SOAP with Attachments 669SOAP Security 670SOAP Transactions 672SOAP 1.2 673The XML Protocol 674
Summary 675
16 Web Services Building Blocks: WSDL and UDDI 677Introduction to WSDL 678Basic WSDL Syntax 679
The definitions Element and Namespaces 682The types Element 682The message and portType Elements 683The binding Element 683The service Element 684The documentation Element 684The import Element 684Extensibility Elements 685
XML and Web ServicesXIV
UNLEASHED
SOAP Binding 685soap:binding, soap:operation, soap:header, and soap:body ....686soap:address, soap:fault, and
soap:headerfault 687Other Bindings 688
WSDL Implementations 688WSDL the Microsoft Way 689WSDL the IBM Way 689
Introduction to UDDI 695UDDI Basics 696The Structure of UDDI 697tModel Structure 699Publishing and Finding WSDL Descriptions in a UDDI
Registry 700UDDI Invocation Model 703
TheUDDIAPI 704Inquiry API 704Publication API 705
Vendor Implementations 707UDDI4J(IBM) 708The Microsoft UDDI SDK 712
The Future of UDDI 716Summary 718
17 Leveraging XML in Visual Studio .NET 719The .NET Strategy 720ADO.NET 722
The ADO.NET Data Provider 723The ADO.NET DataSet Class 729XML Within ADO.NET ,.738
The System.Xml Namespace 758Summary 767
18 Using XML in the .NET Enterprise Servers 769BizTalk 770
Organizations 771Ports 771Channels 772Applications 773Document Definitions 773Document Maps 774WebDAV 774Distribution Lists 775Submitting Documents 775
— XVCONTENTS
SQL Server 2000 776Configuring IIS 777URL Queries 782Template Queries 788XPath Queries 794XML Updategrams 803
Summary 810
PART III Applied XML 811
19 Understanding XML Standards 813Standards and Vocabularies 814
What Is an Open Standard? 818The Standards-Creation Process 818
Standards Organizations: Who Is Creating the Standards? 820The World Wide Web Consortium (W3C) 821The Internet Engineering Task Force (IETF) 823The Organization for the Advancement of Structured
Information Standards (OASIS) 826Governmental Bodies 828Industry Consortia 830Birds-of-a-Feather Vendor Groupings 830Individuals and Organizations 831The Standards Stack 832
Standards Stack Layers 834Message-Oriented Protocols Versus
Document-Oriented Specifications 834XML Base Architecture 835XML Transport Layer 836XML Messaging Layer 836Services Layer 838Process Layer 838
Standards Stack Aspects 839Presentation Aspect 840Security Aspect 840Query Aspect 841Semantics Aspect 841
Community Vocabularies Layer 842Summary 844
20 Implementing XML in E-Business 847What Is the Supply Chain? 848
Business to Consumer (B2C) 851Business to Business (B2B) 852
XML and Web ServicesXVI
UNLEASHED
Electronic Data Interchange (EDI) 853E-Business and the Internet-Enabled Supply Chain 856
E-Commerce 857E-Procurement 858E-Collaboration 858
Different Types of B2B Interaction 859Direct Partnership 859Multiparty Procurement 860Agents and Distributors 860Exchanges, Auctions, and Digital Transaction Hubs 861
Components of E-business XML Systems 861Enterprise Integration 862
Fundamental Network and Platform Layers 862Messaging (Transport, Routing, and Packaging) 864Registry and Repository 864Data Dictionaries 864Process and Workflow 864Trading Partner Agreements 865Business Vocabulary 865
CommerceNet eCo Framework 866XML/EDI 870ebXML 872
Overview of ebXML Process 874Collaborative Protocol Profile 875Core Components 876Registry and Repository 876Messaging 877Business Process and Information Modeling 878Business Messages 880Proof of Concept Demonstration .880More on ebXML Architecture 881Future Development and Maintenance 882
RosettaNet 883Data Dictionaries .„ 884Partner Interface Processes (PIP) 885The RosettaNet Implementation Framework 885Business Process Modeling and Analysis 886Future of RosettaNet 886
Summary 888
21 Delivering Wireless and Voice Services with XML 889The Vision of Ubiquitous Computing 891Key Technologies 892
XVIICONTENTS
Wireless Services: WAP and WML 892Voice Services: VoiceXML 894
Wireless Applications with WAP and WML 896A WML Application Architecture 896WML Applications 897Example: A Wireless Phonebook Service with WML 900WML Structure and Elements 912WMLScript 915Development Primer 916Getting Started 917Future WAP/WML Developments 917
Voice Applications with VoiceXML 919Voice Portals and VoiceXML 919A VoiceXML Application Architecture 920Voice Portal Architecture 921Advantages and Limitations of VoiceXML Applications 922The Profile of a Successful VoiceXML Application 922Example: A Voice Phonebook Service with VoiceXML 923VoiceXML Structure and Elements 933Development Primer 938Future VoiceXML Developments 939
Summary 940
22 Applied XML in Vertical Industry 941The Vertical Industries 943Professional Services Standards 944
Finance and Accounting 945Insurance 955HealthCare 956Legal Industry XML Standards 963Real Estate 968Business Administration and Human Resources (HR) 969Travel and Hospitality 971
Manufacturing 977Shipping and Logistics 978Architecture and Construction 980
Scientific and Engineering 984Biotech 984Chemistry 986
Print, Media, and Entertainment 989NewsML 989
A Final Note: XML Standards Adoption 992Summary 993
XML and Web ServicesXVIII
UNLEASHED
PART IV The Semantic Web 995
23 RDF for Information Owners 997Basics of the Resource Description Framework 998The RDF Family of Specifications 1001
Core Specifications 1001Recent Working Drafts and Notes 1002Making the Case for RDF Investment 1005
The RDF Data Model 1006Just Enough Graph Theory 1006The RDF Graph 1008
RDF Schema 1030Validity in RDF Schema 1030The RDFS Typing System 1031Extensibility 1036
Working with the Angle Brackets 1037Summary 1038
24 The Semantic Web for Information Owners 1039Precursors of the Semantic Web 1041
Project Xanadu 1041HyTime 1042
Architecture of the Semantic Web 1044Unicode and URIs 1045XML Specifications 1052Ontology 1053Logic 1058Proof 1061Trust 1062
How Do Semantics Get into the Semantic Web? 1.1063Summary .1067
PART V Appendix 1069
A Extensible Markup Language (XML) 1.0 (Second Edition)Specification 1071
Abstract 1073Status of This Document 1073Table of Contents 1074Appendices 10761 Introduction 1076
1.1 Origin and Goals 10771.2 Terminology 1077
XIXCONTENTS
2 Documents 10792.1 Well-Formed XML Documents 10792.2 Characters 10802.3 Common Syntactic Constructs 10802.4 Character Data and Markup 10822.5 Comments 10832.6 Processing Instructions 10832.7 CDATA Sections 10842.8 Prolog and Document Type Declaration 10842.9 Standalone Document Declaration 10872.10 White Space Handling 10882.11 End-of-Line Handling 10892.12 Language Identification 1089
3 Logical Structures 10913.1 Start-Tags, End-Tags, and Empty-Element Tags 10923.2 Element Type Declarations 10933.3 Attribute-List Declarations 10963.4 Conditional Sections 1101
4 Physical Structures 11024.1 Character and Entity References 11034.2 Entity Declarations 11054.3 Parsed Entities 11074.4 XML Processor Treatment of Entities and References 11094.5 Construction of Internal Entity Replacement Text 11124.6 Predefined Entities 11134.7 Notation Declarations 11144.8 Document Entity 1114
5 Conformance 11155.1 Validating and Non-Validating Processors 11155.2 Using XML Processors 1115
6 Notation 1116A References 1118
A.I Normative References 1118A.2 Other References 1119
B Character Classes 1120C XML and SGML (Non-Normative) 1125D Expansion of Entity and Character References
(Non-Normative) 1126E Deterministic Content Models (Non-Normative) 1127F Autodetection of Character Encodings (Non-Normative) 1128
F.I Detection Without External Encoding Information 1128F.2 Priorities in the Presence of External Encoding
Information 1130
XML and Web ServicesXX
UNLEASHED
G W3C XML Working Group (Non-Normative) 1131H W3C XML Core Group
(Non-Normative) 1131I Production Notes
(Non-Normative) 1132
Index 1133