Web 310 XML Schema : What You Need to Know and Why Yasser Shohoud Program Manager XML Messaging Microsoft Corporation.

Slides:



Advertisements
Similar presentations
W3C XML Schema: what you might not know (and might or might not like!) Noah Mendelsohn Distinguished Engineer IBM Corp. October 10, 2002.
Advertisements

DEV351 ADO.NET Performance Pablo Castro Program Manager – ADO.NET Team Microsoft Corporation.
WEB401 Security Practices for Web Services (Part 2) Keith Ballinger Program Manager XML Messaging Microsoft Corporation.
1 XML DTD & XML Schema Monica Farrow G30
Achieving Distributed Extensibility and Versioning in XML Dave Orchard W3C Lead BEA Systems.
WEB400 Loose Coupling & Serialization Patterns Clemens Vasters newtelligence AG
SDPL 2003Notes 2: Document Instances and Grammars1 2.5 XML Schemas n A quick introduction to XML Schema –W3C Recommendation, May 2, 2001: »XML Schema Part.
Sunday, June 28, 2015 Abdelali ZAHI : FALL 2003 : XML Schemas XML Schemas Presented By : Abdelali ZAHI Instructor : Dr H.Haddouti.
XML Schema Describing the structure of XML documents. A very brief introduction 1XML Schema.
Introduction to XML This material is based heavily on the tutorial by the same name at
Health Level Seven Experience Report Paul V. Biron Kaiser Permanente W3C XML Schema User Experience Workshop, Jun 21-22, 2005.
DAT304 Leveraging XML and HTTP with Sql Server Irwin Dolobowsky Program Manager Webdata Group.
OFC302 Building Smart Document Solutions in Word & Excel Martin Sawicki Lead Program Manager.
XP New Perspectives on XML Tutorial 4 1 XML Schema Tutorial – Carey ISBN Working with Namespaces and Schemas.
OFC 322 Building Office Research Web Services: Exposing Corporate Data Through Office Brian Jones Program Manager Authoring Services Martin Sawicki Lead.
DEV334 Creating Application Starting Points & Sharing Best Practices with Enterprise Templates Marc Gusmano Director of Emerging Technologies The Information.
OFC304 Excel 2003 Overview: XML Support Joseph Chirilov Program Manager.
Why XML ? Problems with HTML HTML design - HTML is intended for presentation of information as Web pages. - HTML contains a fixed set of markup tags. This.
XML Schema Vinod Kumar Kayartaya. What is XML Schema?  XML Schema is an XML based alternative to DTD  An XML schema describes the structure of an XML.
1 XML Schemas. 2 Useful Links Schema tutorial links:
CSE4500 Information Retrieval Systems XML Schema – Part 1.
DAT305 Boost Your Data-Driven Application Development Using SQL Server Centric.NET Code Generator Pascal Belaud Microsoft France.
OFC 303 Advanced Word XML: Customer-Defined Schemas Brian Jones Program Manager Authoring Services.
DEV325 Deploying Visual Studio.NET Applications Billy Hollis Author / Consultant.
OFC290 Information Rights Management in Microsoft Office 2003 Lauren Antonoff Group Program Manager.
DEV339 Best Practices for Debugging Visual Studio.NET Applications Keith Pleas Architect, Guided Design
OFC 308 Advanced Word XML: The WordML Schema and Bringing Everything Together Brian Jones Program Manager Authoring Services.
Beginning XML 4th Edition. Chapter 5: XML Schemas.
WEB390 Ouch! Common XML Web services headaches (and possible solutions) Christian Weyer Microsoft MSDN Regional Director
SDPL 2005Notes 2.5: XML Schemas1 2.5 XML Schemas n Short introduction to XML Schema –W3C Recommendation, 1 st Ed. May, 2001; 2 nd Ed. Oct, 2004: »XML Schema.
New Perspectives on XML, 2nd Edition
DEV337 Modeling Distributed Enterprise Applications Using UML in Visual Studio.NET David Keogh Program Manager Visual Studio Enterprise Tools.
A Deep Dive into Best Practices with the Windows Communication Foundation John Justice COM415 Program Manager Microsoft Corporation.
10 – 12 APRIL 2005 Riyadh, Saudi Arabia. Visual Studio 2005 : New Features for the Web Services Developer Malek Kemmou CEO Arrabeta Consulting Microsoft.
DEV333 Instrumenting Applications for Manageability with the Enterprise Instrumentation Framework David Keogh Program Manager Visual Studio Enterprise.
Sheet 1XML Technology in E-Commerce 2001Lecture 2 XML Technology in E-Commerce Lecture 2 Logical and Physical Structure, Validity, DTD, XML Schema.
XSD Presented by Kushan Athukorala. 2 Agenda XML Namespaces XML Schema XSD Indicators XSD Data Types XSD Schema References.
XML 2nd EDITION Tutorial 4 Working With Schemas. XP Schemas A schema is an XML document that defines the content and structure of one or more XML documents.
1 Tutorial 14 Validating Documents with Schemas Exploring the XML Schema Vocabulary.
Tutorial 13 Validating Documents with Schemas
EBZ 321 Extending CMS 2002 Publishing Processes Scott Fynn Microsoft Consulting Services National Practices.
XML Schema. Why Validate XML? XML documents can generally have any structure XML grammars define specific document structures Validation is the act of.
DEV303 ASP.NET: Leveraging Visual Studio.NET For Web Projects Tony Goodhew Product Manager Microsoft Corp.
DEV330 Visual Studio.NET IDE Tips and Tricks Billy Hollis Author / consultant.
EGEE is a project funded by the European Union under contract IST XML Schema 3 – 4 June
WEB402 Cross-Platform Interoperability Yasser Shohoud Program Manager XML Messaging Team Microsoft Corporation.
EBIZ327 InfoPath and BizTalk Server 2004 Scott Woodgate Jupiter Product Planner.
Web Services Error Handling and Debugging. Agenda Simple SOAP faults Advanced SOAP faults SOAP headers and faults Error handling From a Service Perspective.
QUALITY CONTROL WITH SCHEMAS CSC1310 Fall BASIS CONCEPTS SchemaSchema is a pass-or-fail test for document Schema is a minimum set of requirements.
David Orchard W3C Lead BEA Systems Web service and XML Extensibility and Versioning.
XSD: XML Schema Language Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
DAT300 SQL Server Notification Services: Application Development Ken Henderson Technical Lead, SQL Server Support Microsoft Corporation
MBL 305 ASP.NET Mobile Controls: Best Practices Gökşin Bakir CSA Yage Ltd. Microsoft Regional Director.
EBIZ302 Jupiter Business Process Automation and Web Services David Fong Program Manager.
DEV332 Programming for the Middle Tier in Visual Basic.NET Billy Hollis Author / Consultant.
EBZ306 Advanced Business Process Automation Using BizTalk Server 2004 David Fong Program Manager.
OFC311 Developing Microsoft Office InfoPath 2003 Solutions: Technical Drilldown Part 1 Tudor Toma Group Program Manager Office Microsoft Corporation.
CSE3201 Information Retrieval Systems XML Schema – Part 2.
The 2007 Microsoft Office System Servers Enterprise Content Management, Workflow and Forms Martin Parry Developer and Platform Group, Microsoft Ltd
PIX/PDQ – Today and Tomorrow Vassil Peytchev Epic.
XSD 2015, Fall Pusan National University HyungGyu Ryoo 1.
Introduction to Web Services Srinath Vasireddy Support Professional Developer Support Microsoft Corporation.
CITA 330 Section 4 XML Schema. XML Schema (XSD) An alternative industry standard for defining XML dialects More expressive than DTD Using XML syntax Promoting.
4 Copyright © 2004, Oracle. All rights reserved. Validating XML by Using XML Schema.
XML Schemas Dr. Awad Khalil Computer Science Department AUC.
XML Schema.
Design and Implementation of Software for the Web
CMP 051 XML Introduction Session IV Chapter 10 – Defining Simple Types
XML Schema Diyar A. Abdulqder
Presentation transcript:

Web 310 XML Schema : What You Need to Know and Why Yasser Shohoud Program Manager XML Messaging Microsoft Corporation

Agenda Understand what XML Schema is and how it is used by ASMX Web services Learn to create XML Schemas using Visual Studio Understand some XML Schema gotchas and best practices

XML Schema and WSDL Why Care About XML Schema? WSDL describes Web Service end points Specifies operations performed by an endpoint Specifies messages understood by the end point Specifies message types using XML Schema

What is XML Schema? Basis of strongly typed XML XML Serialization – ASP.NET Web Services DataSet SQLXML XQuery Contract between producer and consumer of XML

ASP.NET Web Methods Regular methods with [WebMethod] attribute Parameters are CLR objects Return types are CLR objects [WebMethod] public int Add (int x, int y) { return x + y; } Transmitted and received on the wire as XML

ASP.NET Web Methods Under the Covers Strongly Typed XML Mapped to Objects XML Schema is basis of mapping

Validating with XML Schema Use XmlValidatingReader Add the XML schema to its schemas collection Validates as you read Upon error Abort validation Can continue validation if given a ValidationEventHandler Example …

Agenda Understand what XML Schema is and how it is used by ASMX Web services Learn to create XML Schemas using Visual Studio Understand some XML Schema gotchas and best practices

Schema Basics XML Schema lets you declare elements These elements appear in XML documents (instance documents) Each element has a type Choose from over 40 built-in types Or define your own types Defining your own types Simple types: Does not contain elements or attributes Complex types: Contains elements and/or attributes

Example Creating an Order schema Creating classes from schema Creating schema from classes

Agenda Understand what XML Schema is and how it is used by ASMX Web services Learn to create XML Schemas using Visual Studio Understand some XML Schema gotchas and best practices

Beware: Contract not enforced Message Contract Described by XML Schema XmlSerializer does not Enforce the Contract Sequences not enforced Ignores unexpected elements Inserts defaults for missing elements Identity constraints not enforced Simple type restrictions not checked

Enforcing the Contract Having your cake and eating it Use XmlElement parameters and XmlValidatingReader Use a SoapExtension that uses XmlValidatingReader at BeforeDeserialize stage But you need to know the best practices

XML Schema Best Practices Favor the basic simple types Basic types xs:string xs:int / xs:integer / xs:double / xs:float xs:date / xs:time Esoteric types xs:ENTITIES / xs:NOTATION xs:gMonth, xs:gMonthDay xs:unsignedByte

XML Schema Best Practices Use simple type restriction Facets enable stronger contracts Enforce input size (xs:length) Enforce input value range (xs:minInclusive, etc) Enforce input contents (xs:pattern) Restrictions to avoid xs:pattern on non-string types Examples …

XML Schema Best Practices elementFormDefault=“qualified” John Smith John Smith <xs:schema id="SchemaEx1" elementFormDefault="qualified" targetNamespace=" xmlns=" xmlns:mstns=" xmlns:xs=" <xs:element name="FirstName" type="xs:string" /> <xs:element name="LastName" type="xs:string" /> <xs:schema id="SchemaEx1" elementFormDefault="qualified" targetNamespace=" xmlns=" xmlns:mstns=" xmlns:xs=" <xs:element name="FirstName" type="xs:string" /> <xs:element name="LastName" type="xs:string" />

Without elementFormDefault John Smith John Smith <xs:schema id="SchemaEx1" targetNamespace=" xmlns=" xmlns:mstns=" xmlns:xs=" <xs:element name="FirstName" type="xs:string" /> <xs:element name="LastName" type="xs:string" /> <xs:schema id="SchemaEx1" targetNamespace=" xmlns=" xmlns:mstns=" xmlns:xs=" <xs:element name="FirstName" type="xs:string" /> <xs:element name="LastName" type="xs:string" />

XML Schema Best Practices Global elements over global types Global schema components can be reused by other schemas Model groups and complex types are content models Prefer exposing named elements and attributes { element ns:name {xs:string} } of type P ns:person { element ns:name {xs:string}}

XML Schema Best Practices Groups vs. Complex types What is a complex type? xs:group + xs:attributeGroup + type derivation Use groups if content model not reused Groups are externally visible, anonymous complex types are not

XML Schema Best Practices Extensibility and Open Content Use wildcards to enable extensibility in your messages xs:any xs:anyAttribute Typical gotchas with wildcards ##other processContents = “lax” Non-deterministic schema This is key for extensibility and versioning!

XML Schema Best Practices Identity Constraints Prefer key/keyref/unique to id/idref Drawbacks of id/idref Works only on string types Not scoped Limitations on values

XML Schema Best Practices Versioning Schemas Message formats should have a version attribute Incremental, backwards compatible changes Increase version number Significant, backwards incompatible changes Change namespace name

Summary XML Schemas are used to define your data structures Document and message format The basis of Web services contracts You can use Visual Studio to design your schemas Whatever tool you use, apply best practices Open content model is key for versioning Keep it simple for interop

Resources Online resources microsoft.public.dotnet.xml microsoft.public.dotnet.framework.webservic es Real World XML Web Services Addison Wesley, 2003

Ask The Experts Get Your Questions Answered Web Services Booth ATE booth 19/20 Tuesday 5pm – 6pm Wednesday 11am – 12 noon

Community Resources Most Valuable Professional (MVP) Newsgroups Converse online with Microsoft Newsgroups, including Worldwide User Groups Meet and learn with your peers

Appendix… Information on using XmlElement parameters and XmlValidatingReader available at us/dnservice/html/service asp us/dnservice/html/service asp Information on SoapExtension class at us/cpref/html/frlrfSystemWebServicesProtocolsSoapExt ensionClassTopic.htm us/cpref/html/frlrfSystemWebServicesProtocolsSoapExt ensionClassTopic.htm

evaluations evaluations

© 2003 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.