1 / 21

XML and Web Services Delphi 2005 Win32

XML and Web Services Delphi 2005 Win32. Disclaimer. <?xml version=“1.0”?> Occasionally omitted for clarity Too short a session to cover XSLT, XPath or XMLSchema in any depth to explore a non-trivial web service

Download Presentation

XML and Web Services Delphi 2005 Win32

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. XML and Web ServicesDelphi 2005 Win32

  2. Disclaimer • <?xml version=“1.0”?> • Occasionally omitted for clarity • Too short a session • to cover XSLT, XPath or XMLSchema in any depth • to explore a non-trivial web service • Too short a session to cover discovery, specification and classification of web services • No UDDI (Universal Description, Discovery and Integration ) • No WSDL (Web Service Description Language) • Not a SOAP session! • SOAP is an “XML protocol”, we’ll use it over HTTP Delphi 2005 Refactoring

  3. Agenda • Motivation • Prerequisites • Working with XML documents • XML using Delphi 2005 • .net • VCL using System.XML • Win32 • Web Services in Delphi 2005 • ASP.net • Win32 • Summary Delphi 2005 Refactoring

  4. Prerequisites • XML Syntax • XML’s raison d’être • platform-independence; interoperability • human readable & self-describing, on the whole • extensibility • parser availability <?xml version=“1.0”?> <!-- this is a comment --> <employees> <employee no=“1”> <name>Frank Butcher</name> <car reg=“R872 BFS” model=“Vectra” /> </employee> </employees> Delphi 2005 Refactoring

  5. Motivation • To look at XML and web service support in Delphi 2005 • “Rightly or wrongly, XML is everywhere” • We need platform-independent data exchange mechanisms • Strong-typing is crucial • for validation • for verification • New to XML? • Demonstration of common [XML] idioms • Loading XML documents • Creating XML documents • Traversing XML documents • Locating XML elements • Validating XML documents • Transformation Delphi 2005 Refactoring

  6. Motivation • Loosely coupled architectures • disconnected vs connected models • language neutral data access • Five years ago: XML was emerging as a universal data format • Over the last two/three years: XML is a universal data format • XML is a core part of the .net Framework Delphi 2005 Refactoring

  7. Working with XML documents • Two distinct methods: • Document Object Model (DOM) • Simple API for XML (SAX) Delphi 2005 Refactoring

  8. Working with XML documentsDocument Object Model • entire XML document is loaded into memory • not very memory efficient • rapid access • random access to any part of the document • implemented in MSXML 2 onwards • OpenXML • The CLR Delphi 2005 Refactoring

  9. W3C Document Object Model (DOM) • DOM is a standard set of “interfaces” • the DOM is a specification • there is no implied code • consistent object hierarchy • Vendors build “DOM implementations” • “code that implements the interfaces” • e.g. MSXML3, MSXML4 • e.g. Xerces • e.g. OpenXML Delphi 2005 Refactoring

  10. Working with XML documentsSimple API for XML (SAX) • event-driven • access to a document is incremental • forward-only access • access speed limited by media latency, etc. • very memory efficient • ideal for processing large XML documents • implemented in MSXML3 onwards Delphi 2005 Refactoring

  11. No SAX in .net • SAX • Forward-only, read-only access to an XML document • Ability to skip elements that are not required • Implemented in .net’s XMLReader class: • XMLTextReader • no validation against DTD or schema • XMLNodeReader • no validation, returns instances of XmlNode • XMLValidatingReader • full validation against DTD or multiple schemas Delphi 2005 Refactoring

  12. demo Using XML in Delphi 2005 Delphi 2005 Refactoring

  13. Web Services in Delphi 2005 • Prior to Delphi 6, web services were: • Built using raw TCP/IP and SOAP; requests/responses built manually; possibly used Indy • Not type-safe • Error-prone • Delphi 6 changed all that, web services are now: • Still built using SOAP, but managed by tool support • Type-safe, both on the client and server • Because of tool support, repeatable, very much less error prone Delphi 2005 Refactoring

  14. demo Web Services in Delphi 2005 Delphi 2005 Refactoring

  15. Design Considerations • Use .net classes with care • System.Xml is available for: • Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows .NET Server family, .NET Compact Framework - Windows CE .NET Delphi 2005 Refactoring

  16. Summary • The [XML] DOM is portable between platforms • learn it once, use it often • often extended for persistency (load/save) • Building Web Services • Target multiple platforms: Win32, .net and even mobile devices • Consider resilience, don’t put all your eggs in one basket • Try to purchase the web service (and source!) to deploy on your infrastructure • Watch out for changing interfaces! Delphi 2005 Refactoring

  17. Resources (web-sites) • O’Reilly’s resources: • XML.COM: http://www.xml.com/ • WebServices.xml.com: http://webservices.xml.com/ • What is Service-Oriented Architecture (SOA)? • http://webservices.xml.com/pub/a/ws/2003/09/30/soa.html • Web Service Repositories/Brokerages: • http://www.salcentral.com • http://www.xmethods.com • Taking a step back from the power and abstractions: • http://www.craigmurphy.com/SOAP/SimpleSOAPClient.htm Delphi 2005 Refactoring

  18. Resources (Books) Web Services Essentials Etham Cerami Addison-Wesley, 2002 ISBN 0-596-00224-6 (avoid books “WSDL heavy”) _____________________________ XML in a Nutshell (3rd Edition) Elliotte Rusty Harold, W.Scott Means Addison-Wesley, 2004 ISBN 0-596-00764-7 Delphi 2005 Refactoring

  19. Contact and Update Information Craig Murphy Updated slides, notes and source code: http://www.CraigMurphy.com Delphi 2005 Refactoring

  20. Questions? Delphi 2005 Refactoring

  21. Delphi 2005 Refactoring

More Related