380 likes | 611 Views
XML. Ahmet Şentürk CmpE-587. Content. XML XML Syntax XML Core Technologies WebDAV XML Web Services. What is XML . self-describing documents textual markup (tags) a simplified version of SGML more suitable for use on the Web
E N D
XML Ahmet Şentürk CmpE-587
Content • XML • XML Syntax • XML Core Technologies • WebDAV • XML Web Services
What is XML • self-describing documents • textual markup (tags) • a simplified version of SGML • more suitable for use on the Web • HTML provides rich facilities for display, it does not provide any standards-based way to manage data as data • XML provides a data standard that can encode the content, semantics, and schemata for a wide variety of cases • offers a universal way to describe and work with data
Benefits Of XML • provides a universal ,powerful, flexible format for expressing data • data delivered to the desktop can be manipulated locally • Unicode • a description of the structure of the data • the data is now separate from the presentation • XML offers a mechanism for adding meta-data or meta-content to HTML • enables wide array of business applications to be implemented on the Internet
XML Syntax • for describing your data <book name=“The Lord Of The Rings" lowfat="J.R.R. Tolkien"/> • begin and end tags and attributes • case-sensitive • text-based (similar to HTML) • white space • considered well-formed if it contains exactly one root element and all the child elements are nested properly within each other
XML Syntax • store and transmit data • an unlimited set of tags • Strictly a Tree • An example well-formed XML document <?xml version="1.0"?> <hamburgers> <hamburger lowfat="dream on"> <name>CowBurger</name> <description>Greasy and good.</description> <price>2.99</price> </hamburger> </hamburgers>
XML Namespaces • provide a context for your XML document elements • resolve elements to a particular implementation semantic • Price : Sale price or purchase price <?xml version="1.0"?> <hamburgers xmlns:purchase="http://fastfood.org/franchise/prices" xmlns:sales="http://fastfood.org/customer/prices"> <hamburger lowfat="dream on"> <name>CowBurger</name> <description>Greasy and good.</description> <purchase:price>0.99</price> <sales:price>2.99</price> </hamburger> </hamburgers>
XML Core Technologies • Validation Technologies • Schemas • a formal specification of the rules of an XML document • Document Type Definitions <!DOCTYPE hamburgers SYSTEM "hamburger.dtd">
Hamburger.dtd <!ELEMENT hamburgers(hamburger)*> <!ELEMENT hamburger(name, description, price)> <!ATTLIST hamburgerlowfat CDATA #IMPLIED> <!ELEMENT name(#PCDATA)> <!ELEMENT description(#PCDATA)> <!ELEMENT price(#PCDATA)> #PCData (parsed character data)
XML Core Technologies • XML-Data <?xml version="1.0"?> <Schema xmlns="schemas-microsoft-com:xml-data"> <ElementType name="name" /> <ElementType name="description" /> <ElementType name="price" /> <AttributeType name="lowfat" /> <ElementType name="hamburger" /> <element type="name" maxOccurs="1" /> <element type="description" maxOccurs="1" /> <element type="price" maxOccurs="1" /> <attribute type="lowfat" maxOccurs="1" /> </ElementType> <ElementType name="hamburgers" model="closed"> <element type="hamburger" maxOccurs="*" /> </ElementType> </Schema>
XML Core Technologies • Processor (API) Technologies • DOM • in-memory tree representation of the XML document
XML Core Technologies • Processor (API) Technologies • SAX • event-driven XML parsing • doesn't require the entire XML file to be loaded into memory • event handlers to just-in-time process
XML Core Technologies • Transformation Technologies • XSL Patterns • /hamburgers/hamburger[@lowfat="yes"]/price • XSL • XML File <?xml version="1.0"?> <hamburgers> <hamburger lowfat="dream on"> <name>CowBurger</name> <description>Greasy and good.</description> <price>2.99</price> </hamburger> </hamburgers>
XML Core Technologies • XSL Transformation <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl=“http://www.w3.org/TR/WD-xsl "> <xsl:template match="/"> <html> <body> <h1>hamburgers</h1> <xsl:for-each select="hamburgers[@lowfat="dream on"]> <li><xsl:value-of select="name"/>, <xsl:value-of select="price"/>, <xsl:value-of select="description"/></li> </xsl:for-each> </body> </html> </xsl:template> </xsl:stylesheet>
XML Core Technologies • HTML Output <html> <body> <h1>hamburgers</h1> <ol> <li>CowBurger, $2.99, Greasy and good.</li> </ol> </body> </html>
XML Core Technologies • Linking Technologies • XLink <hamburger xml:link="simple" HREF = "http://fastfood.org/hamburger.htm"></hamburger> • XPointer child(2,hamburger) • Other Technologies • Mathematical Markup Language (MathML) • Synchronized Multimedia Integration Language (SMIL) • Vector Markup Language (VML)
WebDAV • Web Distributed Authoring and Versioning • Communicating XML Data over the Web • an important communication protocol for the Web as an extension to HTTP 1.1 • useful in client/server architecture
WebDAV • Protocol Problem • HTTPfor static documents intended for viewing • “lost update” problem • Three major major concerns of collaborative authoring in WebDAV • Overwrite Protection • Resource Management • Document Properties
The Format of WebDAV Requests • set of methods that clients can use to communicate with servers • Options, Head, and Trace • Get • Put and Post • Delete • Mkcol • PropFind and PropPatch • Copy and Move • Lock and Unlock
What XML Means to WebDAV • HTTP communicate with headers • WebDAV require a great deal of information to be associated with both requests and responses • Because of its inherent extensibility, XML was chosen to describe how these instructions are communicated • A method of formatting instructions describing how data is to be handled. • A method of formatting complex responses from the server. • A method of communicating customized information about the collections and resources handled. • A flexible vehicle for the data itself.
XML Web Services • fundamental building blocks in the move to distributed computing on the Internet • communication and collaboration among people and applications • application integration • constructed using multiple XML Web services • from various sources • work together • regardless of where they reside or how they were implemented • primary advantages • allows programs written in different languages on different platforms to communicate with each other in a standards-based way
XML Web Services • many definitions : • XML Web Services expose useful functionality to Web users through a standard Web protocol, SOAP. • XML Web services provide a way to describe their interfaces in enough detail to allow a user to build a client application to talk to them, called a Web Services Description Language (WSDL) document • XML Web services are registered so that potential users can find them easily, with Universal Discovery Description and Integration (UDDI).
What Can I Do With XML Web Services • information sources that you could easily incorporate into applications • more powerful applications that use XML Web services as building blocks
SOAP • communication protocol for XML Web services • defines the XML format for messages • Remote Procedure Calls • SOAP message containing a callable function • parameters to pass to the function, is sent from the client • server returns a message with the results of the executed function • define security for web services
Why Should I Use SOAP? • implemented on many different hardware and software • can be used to link separate systems • RPC • HTTTP
WSDL • a WSDL file is an XML document that describes a set of SOAP messages and how the messages are exchanged • based on the XML Schema • defines where the service is available and what communications protocol is used to talk to the service
WSDL Document Structure • Abstract Definitions(define SOAP messages ) • Types : Machine- and language-independent type definitions • Messages : Contains function parameters or documentdescripttions • PortTypes : function signatures (operation name, input parameters, output pameters • Concrete Descriptions • Bindings :Specifies binding(s) of each operation • Services : Specifies port address(es) of each binding, syntax for calling methods
UDDI • yellow pages of Web services • Search web service • Read about it • Get more information about service • to reach a significant market, you need UDDI • an XML file that describes a business and the services it offers
UDDI • 3 parts of an entry in UDDI • white pages : describe the company offering the service • yellow pages : include industrial categories • green pages : describe the interface to the service • UDDI directory includes several ways to search for the services
What XML Do You Post? • SOAP Envelope <?xml version='1.0' encoding='UTF-8'?> <Envelopexmlns='http://schemas.xmlsoap.org/soap/envelope/'> <Body>…</Body> </Envelope> • Contents of body can be any query <find_business generic="1.0" xmlns="urn:uddi-org:api"> <name>Microsoft</name> </find_business>
How Do You Post the XML? • Form a Jscript file or HTML page by XMLHTTP http = new ActiveXObject("Microsoft.XMLHTTP"); http.open("POST", url, false); http.setRequestHeader("Accept","text/xml"); http.setRequestHeader("Cache-Control","no-cache"); http.setRequestHeader("SOAPAction",'""'); http.send(msg);
What Do You Get Back? • XML of course <businessList generic="1.0" operator="Microsoft Corporation" truncated="false" xmlns="urn:uddi-org:api"> <businessInfos> <businessInfo businessKey="0076B468-EB27-42E5-AC09-9955CFF462A3"> <name>Microsoft Corporation</name> <description xml:lang="en">Empowering people through great software - any time, any place and on any device is Microsofts vision. As the worldwide leader in software for personal and business computing, we strive to produce innovative products and services that meet our customer's </description> <serviceInfos> <serviceInfo businessKey="0076B468-EB27-42E5-AC09-9955CFF462A3" serviceKey="1FFE1F71-2AF3-45FB-B788-09AF7FF151A4"> <name>Web services for smart searching</name> </serviceInfo>
.NET application architecture • multiple Web Services that work together to provide data and services for the application
Reliable XML Web Services • Standards Based • Acknowledged Delivery • Ordered Delivery • Symmetric Conversations • Promotes Asynchronous Processing
Synchronous Messaging • The connection may be broken by an external source, dropping either the request or response • The server may timeout because it is offline or overloaded • The server process may be dependant upon down stream services that have uncontrollable response times.