xml ahmet Şentürk cmpe-587. content xml xml syntax xml core technologies webdav xml web services

38
XML Ahmet Şentürk CmpE-587

Upload: noah-walker

Post on 20-Jan-2016

261 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

XML

Ahmet ŞentürkCmpE-587

Page 2: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

Page 3: 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

Page 4: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

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

Page 5: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

XML Syntax for describing your data <<bookbook name=“ name=“The Lord Of The RingsThe Lord Of The Rings" lowfat="" lowfat="J.R.R. TolkienJ.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

Page 6: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

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>

Page 7: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

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>

Page 8: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

XML Core Technologies Validation Technologies Schemas

a formal specification of the rules of an XML document

Document Type Definitions <!DOCTYPE hamburgers SYSTEM "hamburger.dtd"><!DOCTYPE hamburgers SYSTEM "hamburger.dtd">

Page 9: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

Hamburger.dtd<!ELEMENT hamburgers(hamburger)*><!ELEMENT hamburgers(hamburger)*>

<!ELEMENT hamburger(name, description, price)><!ELEMENT hamburger(name, description, price)>

<!ATTLIST hamburgerlowfat CDATA #IMPLIED><!ATTLIST hamburgerlowfat CDATA #IMPLIED>

<!ELEMENT name(#PCDATA)><!ELEMENT name(#PCDATA)>

<!ELEMENT description(#PCDATA)><!ELEMENT description(#PCDATA)>

<!ELEMENT price(#PCDATA)><!ELEMENT price(#PCDATA)>

#PCData (parsed character data)

Page 10: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

XML Core Technologies XML-Data<?xml version="1.0"?><?xml version="1.0"?><Schema xmlns="schemas-microsoft-com:xml-data"> <Schema xmlns="schemas-microsoft-com:xml-data">

<ElementType name="name" /> <ElementType name="name" /> <ElementType name="description" /> <ElementType name="description" /> <ElementType name="price" /> <ElementType name="price" /> <AttributeType name="lowfat" /> <AttributeType name="lowfat" /> <ElementType name="hamburger" /> <ElementType name="hamburger" />

<element type="name" maxOccurs="1" /> <element type="name" maxOccurs="1" /> <element type="description" maxOccurs="1" /> <element type="description" maxOccurs="1" /> <element type="price" maxOccurs="1" /> <element type="price" maxOccurs="1" /> <attribute type="lowfat" maxOccurs="1" /> <attribute type="lowfat" maxOccurs="1" />

</ElementType> </ElementType> <ElementType name="hamburgers" model="closed"> <ElementType name="hamburgers" model="closed">

<element type="hamburger" maxOccurs="*" /> <element type="hamburger" maxOccurs="*" /> </ElementType></ElementType>

</Schema></Schema>

Page 11: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

XML Core Technologies Processor (API) Technologies

DOM in-memory tree representation of the XML

document

Page 12: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

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

Page 13: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

XML Core Technologies Transformation Technologies

XSL Patterns /hamburgers/hamburger[@lowfat="yes"]/price/hamburgers/hamburger[@lowfat="yes"]/price

XSL XML File

<?xml version="1.0"?><?xml version="1.0"?><hamburgers> <hamburgers> <hamburger lowfat="dream on"> <hamburger lowfat="dream on"> <name>CowBurger</name> <name>CowBurger</name> <description>Greasy and good.</description> <description>Greasy and good.</description> <price>2.99</price><price>2.99</price>

</hamburger></hamburger></hamburgers></hamburgers>

Page 14: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

XML Core Technologies XSL Transformation

<?xml version="1.0"?><?xml version="1.0"?><xsl:stylesheet xmlns:xsl=<xsl:stylesheet xmlns:xsl=““http://www.w3.org/TR/WD-xsl "> http://www.w3.org/TR/WD-xsl "> <xsl:template match="/"> <xsl:template match="/">

<html> <html> <body> <body>

<h1>hamburgers</h1> <h1>hamburgers</h1> <xsl:for-each select="hamburgers[@lowfat="dream on"]> <xsl:for-each select="hamburgers[@lowfat="dream on"]>

<li><xsl:value-of select="name"/>, <li><xsl:value-of select="name"/>, <xsl:value-of select="price"/>, <xsl:value-of select="price"/>,

<xsl:value-of select="description"/></li> <xsl:value-of select="description"/></li> </xsl:for-each> </xsl:for-each>

</body> </body> </html> </html>

</xsl:template></xsl:template></xsl:stylesheet></xsl:stylesheet>

Page 15: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

XML Core Technologies HTML Output<html><html><body><body>

<h1>hamburgers</h1><h1>hamburgers</h1><ol> <ol> <li>CowBurger, $2.99, Greasy and <li>CowBurger, $2.99, Greasy and

good.</li>good.</li></ol></ol>

</body></body></html></html>

Page 16: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

XML Core Technologies Linking Technologies

XLink<hamburger xml:link="simple" HREF = <hamburger xml:link="simple" HREF = "http://fastfood.org/hamburger.htm"></hamburger>"http://fastfood.org/hamburger.htm"></hamburger>

XPointer child(2,hamburger)child(2,hamburger)

Other Technologies Mathematical Markup Language (MathML) Synchronized Multimedia Integration Language (SMIL) Vector Markup Language (VML)

Page 17: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

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

Page 18: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

WebDAV Protocol Problem

HTTP for static documents intended for viewing

“lost update” problem Three major major concerns of

collaborative authoring in WebDAV Overwrite Protection Resource Management Document Properties

Page 19: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

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

Page 20: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

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.

Page 21: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

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

Page 22: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

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).

Page 23: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

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

Page 24: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

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

Page 25: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

Why Should I Use SOAP? implemented on many different

hardware and software can be used to link separate

systems RPC HTTTP

Page 26: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

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

Page 27: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

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

Page 28: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

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

Page 29: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

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

Page 30: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

What XML Do You Post? SOAP Envelope

<?xml version='1.0' encoding='UTF-8'?><?xml version='1.0' encoding='UTF-8'?>

<Envelope<Envelope xmlns='http://schemas.xmlsoap.org/soap/envelope/'xmlns='http://schemas.xmlsoap.org/soap/envelope/'>>

<Body><Body>……</Body></Body>

</Envelope></Envelope>

Contents of body can be any query <find_business generic="1.0" xmlns="urn:uddi-<find_business generic="1.0" xmlns="urn:uddi-org:api"> org:api"> <name>Microsoft</name><name>Microsoft</name>

</find_business></find_business>

Page 31: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

How Do You Post the XML? Form a Jscript file or HTML page by

XMLHTTP http = new http = new ActiveXObject("Microsoft.XMLHTTP"); ActiveXObject("Microsoft.XMLHTTP"); http.open("POST", url, false); http.open("POST", url, false); http.setRequestHeader("Accept","text/xmhttp.setRequestHeader("Accept","text/xml"); http.setRequestHeader("Cache-l"); http.setRequestHeader("Cache-Control","no-cache"); Control","no-cache"); http.setRequestHeader("SOAPAction",'""'http.setRequestHeader("SOAPAction",'""'); http.send(msg);); http.send(msg);

Page 32: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

What Do You Get Back? XML of course <businessList generic="1.0" operator="Microsoft Corporation" <businessList generic="1.0" operator="Microsoft Corporation"

truncated="false" xmlns="urn:uddi-org:api"> truncated="false" xmlns="urn:uddi-org:api"> <businessInfos> <businessInfos> <businessInfo businessKey="0076B468-EB27-42E5-AC09-9955CFF462A3"> <businessInfo businessKey="0076B468-EB27-42E5-AC09-9955CFF462A3"> <name>Microsoft Corporation</name> <name>Microsoft Corporation</name> <description xml:lang="en">Empowering people through great software <description xml:lang="en">Empowering people through great software - any time, any place and on any device is Microsofts vision. As - any time, any place and on any device is Microsofts vision. As the worldwide leader in software for personal and business the worldwide leader in software for personal and business computing, we strive to produce innovative products and services computing, we strive to produce innovative products and services that meet our customer's that meet our customer's </description> </description> <serviceInfos> <serviceInfos> <serviceInfo businessKey="0076B468-EB27-42E5-AC09-9955CFF462A3" <serviceInfo businessKey="0076B468-EB27-42E5-AC09-9955CFF462A3" serviceKey="1FFE1F71-2AF3-45FB-B788-09AF7FF151A4"> serviceKey="1FFE1F71-2AF3-45FB-B788-09AF7FF151A4"> <name><name>Web services for smart searchingWeb services for smart searching</name> </name> </serviceInfo></serviceInfo>

Page 33: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

.NET application architecture multiple Web Services that work together to provide

data and services for the application

Page 34: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

Generic Architecture for a Web Service

Page 35: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

Reliable XML Web Services Standards Based Acknowledged Delivery Ordered Delivery Symmetric Conversations Promotes Asynchronous

Processing

Page 36: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

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.

Page 37: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

Synchronous Messaging

Page 38: XML Ahmet Şentürk CmpE-587. Content XML XML Syntax XML Core Technologies WebDAV XML Web Services

Asynchronous Model