xml & web services

52
XML & Web Services

Upload: yoko

Post on 13-Jan-2016

35 views

Category:

Documents


1 download

DESCRIPTION

XML & Web Services. Structuring Web Documents: Cascading Style Sheets & XML. Structured Formatting Introduction to CCS Structured Web Document Introduction to XML. XML. XML DTD CSS XSL. XML What is it?. e X cellent M arketing L ingo e X citing M odern L anguage - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: XML & Web Services

XML & Web Services

Page 2: XML & Web Services

Structuring Web Documents:Cascading Style Sheets &

XML

• Structured Formatting• Introduction to CCS• Structured Web Document• Introduction to XML

Page 3: XML & Web Services

XML

• XML• DTD• CSS• XSL

Page 4: XML & Web Services

• eXcellent Marketing Lingo

• eXciting Modern Language

• eXcessive aMount of pubLicity

XML XML What is it?What is it?

Page 5: XML & Web Services

Example: Self-describing data

“ABC47-Z”, “100”, “STL”, “C”, “3”, “28”Data stream in a typical interface…

<INVENTORY><PART_NUM>ABC47-Z</PART_NUM><QUANTITY>100</QUANTITY><WAREHOUSE>STL</WAREHOUSE><ZONE>C</ZONE><AISLE>3</AISLE><BIN>28</BIN>

</INVENTORY>

Same data stream in XML…

Page 6: XML & Web Services

What’s so great about XML?

• The data is self-describing• The meaning of the data is included: identifiers

surround every bit of data, indicating what it means• Far more flexible method of representing transmitted

information • Batched orders sent together can have different fields

and format without breaking apps on each end• Open, standard technologies for moving, processing and

validating the data• The XML parser built into IE5 can automatically parse,

validate, and feed the information to an application, instead of every application having to include this functionality

Page 7: XML & Web Services

What does XML look like?

<?xml version=“1.0”?> (prolog)

<Book> (root element) <Author>Vetter, R.</Author> <Author>Ward, D.</Author> <Author>Lugo, G.</Author> <Title>H/PCs : Ignore the Hype</Title> <Publisher>RDG Publishing Inc.</Publisher> <Year>2003</Year></Book>

Case Sensitive! <book> vs. <Book> vs. <BOOK> = 3 different tags!!!!

Page 8: XML & Web Services
Page 9: XML & Web Services

XML• eXtensible Markup Language• Defines data• Improved “CSV” format• Recordset (Rows & Columns)• Data can be hierarchical• Each file can contain multiple record sets• See customer.xml

Page 10: XML & Web Services

Valid

1. Valid documents are well-formed documents that conform to a DTD.

2. When the document is parsed by an application, it can be checked for the presence of required portions.

3. There are many programs, known as parsers, available for XML. Some of these parsers are able to validate a XML document against a DTD (validating parsers such as IE 5).

Page 11: XML & Web Services

Explanation - XML Document

• A XML document contains two parts• Document type definition (DTD) - specify the

document structure, entities, and type• Markup file - the application of the type to actual

data (text)

DTDDTD

Markup fileMarkup file

Page 12: XML & Web Services

Explanation - DTD • This example defines the following

document tree structure:

COURSELISTCOURSELIST

STUDENTSTUDENT

CLASSNAMECLASSNAME

FIRSTNAMEFIRSTNAME

LASTNAMELASTNAME

Page 13: XML & Web Services

A XML Document Example <?xml Version=“1.0” Encoding=“UTF-8”?><!DOCTYPE simple [ <!ELEMENT COURSELIST(STUDENT,CLASSNAME+)> <!ELEMENT STUDENT (FIRSTNAME,LASTNAME)>

<!ELEMENT FIRSTNAME (#PCDATA)><!ELEMENT LASTNAME (#PCDATA)>

<!ELEMENT CLASSNAME (#PCDATA)><!ELEMENT description “This is a very simple

example”>]><COURSELIST> <STUDENT> <FIRSTNAME> Susan </ FIRSTNAME >

<LASTNAME> Glass </ LASTNAME > </STUDENT >

<CLASSNAME> CIS 8110 Intro. To IS </CLASSNAME></ COURSELIST>

Page 14: XML & Web Services

A XML Document Example <COURSELIST> <STUDENT> <FIRSTNAME> Jeo </ FIRSTNAME >

<LASTNAME> Suess </ LASTNAME > </STUDENT >

<CLASSNAME> CIS 8110 Intro. To IS </CLASSNAME> <CLASSNAME> CIS 8120 OO Prototyping </CLASSNAME>

<CLASSNAME> CIS 8140 Intro. To DBMS </CLASSNAME></ COURSELIST>

< COURSELIST> <STUDENT> <FIRSTNAME> John </ FIRSTNAME >

<LASTNAME> Smith </ LASTNAME > </STUDENT >

<CLASSNAME> CIS 8110 Intro. To IS </CLASSNAME> <CLASSNAME> CIS 8140 Intro. To DBMS </CLASSNAME></ COURSELIST>

Page 15: XML & Web Services

DTD

• Document Type Definition• Defines structure of an XML document• Can be defined within XML or linked in

• <!DOCTYPE books SYSTEM “books.dtd”>• <!DOCTYPE books SYSTEM

http://wareham.eci.gsu/xmlcases/books.dtd”>

• DTDs still difficult to read and program XML schemas on the way from http://www.w3.org/tr/

• XML schemas USE XML syntax, not EBNF

Page 16: XML & Web Services

Using DTD and XML Documents

DTD

<!DOCTYPE books [

<!ELEMENT books (book)*>

XML

DTD

<!DOCTYPE books [

<!ELEMENT books (book)*>

XML

Page 17: XML & Web Services

Explanation - Data View

• The data in the document may come from a database:

FIRSTNAME LASTNAME CLASSNAME

SuzanGlass CIS 8110 Intro. To ISJoe Suess CIS 8110 Intro. To ISJoe Suess CIS 8120 OO PrototypingJoe Suess CIS 8140 Intro. To DBMSJohn Smith CIS 8110 Intro. To ISJohn Smith CIS 8140 Intro. To DBMS

Page 18: XML & Web Services

What’s Missing in DTDs?

• Cannot manipulate ‘DTD’s like XML documents

• Syntax different from XML documents

• Lack of data typing

• XSL: Schemas

• Data Typing

• Open/Closed Models

• Can use XML tools with XML schemas

Page 19: XML & Web Services

An Example Schema<?xml version = "1.0"?><!-- Microsoft XML Schema showing the ElementType --><Schema xmlns = "urn:schemas-microsoft-com:xml-data"><ElementType name = "message" content = "textOnly" model =

"closed"> <description>Text messages</description></ElementType><ElementType name = "greeting" model = "closed“ content = "mixed" order = "many"><element type = "message"/></ElementType><ElementType name = "myMessage" model = "closed“ content = "eltOnly" order = "seq"> <element type = "greeting" minOccurs = "0“ maxOccurs = "1"/> <element type = "message" minOccurs = "1" maxOccurs = "*"/></ElementType></Schema>

Page 20: XML & Web Services

A Corresponding Instance

<?xml version = "1.0"?>

<!-- Introduction to Microsoft XML Schema -->

<myMessage xmlns = "x-schema:intro-schema.xml">

<greeting>Welcome to XML Schema!

<message>This is the first message.</message>

</greeting>

<message>This is the second message.</message>

</myMessage>

Page 21: XML & Web Services

Data Types in Schemas

<?xml version = "1.0"?><Schema xmlns = "urn:schemas-microsoft-com:xml-data" xmlns:dt = "urn:schemas-microsoft-com:datatypes"><ElementType name = "bookstore" content = "eltOnly“ order = "many" model = "closed"> <element type = "shipping"/> <element type = "book"/> </ElementType><ElementType name = "shipping" content = "eltOnly" order = "seq" model = "closed"> <AttributeType name = "shipID" dt:type = "id" required = "yes"/> <attribute type = "shipID"/> <element type = "duration"/></ElementType><ElementType name = "duration" content = "textOnly" model = "closed" dt:type =

"date"/><ElementType name = "book" content = "textOnly" model = "closed“dt:type = "string"> <AttributeType name = "shippedBy" dt:type = "idref"/> <attribute type = "shippedBy"/></ElementType></Schema>

Page 22: XML & Web Services

Data Types in Schemas 2<?xml version = "1.0"?><Schema xmlns = "urn:schemas-microsoft-com:xml-data" xmlns:dt = "urn:schemas-microsoft-com:datatypes"><ElementType name = "inventory" content = "eltOnly" model = "closed"> <element type = "book" minOccurs = "0" maxOccurs = "*"/></ElementType><ElementType name = "book" content = "eltOnly" order = "seq" model = "closed"> <AttributeType name = "isbn" dt:type = "string" required = "yes"/> <attribute type = "isbn"/> <AttributeType name = "inStock" dt:type = "enumeration" dt:values = "yes no" default = "no"/> <attribute type = "inStock"/> <element type = "name"/> <element type = "price"/> <group order = "one"> <element type = "quantity"/> <element type = "available"/> </group></ElementType> <ElementType name = "name" content = "textOnly" model = "closed" dt:type = "string"/> <ElementType name = "price" content = "textOnly" model = "closed" dt:type = "float"/> <ElementType name = "quantity" content = "textOnly" dt:type = "int" model = "closed"/> <ElementType name = "available" content = "textOnly" dt:type = "date" model = "closed"/></Schema>

Page 23: XML & Web Services

A Corresponding Instance

<?xml version = "1.0"?>

<!-- Data type example -->

<inventory xmlns = "x-schema:inventory-schema.xml">

<book isbn = "0-13-012507-5" inStock = "yes">

<name>Java How to Program 3/e</name>

<price>68.00</price>

<quantity>200</quantity>

</book>

<book isbn = "0-13-028418-1" inStock = "no">

<name>Perl How to Program</name>

<price>68.00</price>

<available>2000-12-15</available>

</book>

</inventory>

Page 24: XML & Web Services

Microsoft XML Parser (MSXML)Provides core XML services

• DOM parser that takes a text stream and turns it into a XML tree structure

• Validating parser for DTD’s and XML Schemas

• XSLT processor that applies XSLT rules to XML to product output

• SAX (Simple API for XML) parser optimized for handling large documents and high-throughput scenarios

Page 25: XML & Web Services

XSL

• eXtensible Stylesheet Language• Template for displaying XML data• Client-side (browser dependent)• Server-side (browser independent)• See customer.xsl, customer_xsl.xml,

customer_transform.xml

Page 26: XML & Web Services
Page 27: XML & Web Services
Page 28: XML & Web Services

XML Auction Demo

Page 29: XML & Web Services

XML and HL7

• Health Level 7 – Application level protocol for communicating medical data

• Clinical data• ADT (admission/discharge/transfers)• ORDERS• REPORTS

• Administrative data• Billing• Insurance

Page 30: XML & Web Services

An HL7 messageMSH|^~\&| LABGL1|| DMCRES|| 199812300100|| ORU^ R01| LABGL1199510221838581| P|

2.3||| NE| NEPID||| 6910828^ Y^ C8|| Newman^ Alfred^ E|| 19720812| M|| W| 25 Centscheap Ave^^Whatmeworry^ UT^ 85201^^ P||( 555) 777- 6666|( 444) 677- 7777|| M|| 773789090OBR|| 110801^ LABGL| 387209373^ DMCRES| 18768- 2^ CELL COUNTS+ DIFFERENTIAL

TESTS(COMPOSITE)^ LN||| 199812292128|| 35^ ML||||||| IN2973^ Schadow^ Gunther^^^^ MD^ UPIN||||||||||^ Once|||||| CA20837^ Spinosa^ John^^^^ MD^ UPINOBX|| NM| 4544- 3^ HEMATOCRIT (AUTOMATED)^ LN|| 45|| 39- 49|||| F||| 199812292128|| CA20837OBX|| NM| 789- 8^ ERYTHROCYTES COUNT (AUTOMATED)^ LN|| 4. 94| 10* 12/ mm3|4.30- 5.90|||| F||| 199812292128|| CA20837110801^ LABGL| 387209373^ DMCRES| 18768- 2^ CELL COUNTS+ DIFFERENTIAL TESTS(COMPOSITE)^ LN||| 199812292128|| 35^ ML||||||| IN2973^ Schadow^ Gunther^^^^ MD^ UPIN||||||||||^ Once|||||| CA20837^ Spinosa^ John^^^^ MD^ UPINNM| 4544- 3^ HEMATOCRIT (AUTOMATED)^ LN|| 45|| 39- 49|||| F||| 199812292128|| CA20837NM| 789- 8^ ERYTHROCYTES COUNT (AUTOMATED)^ LN|| 4. 94| 10* 12/ mm3|4.30- 5.90|||| F||| 199812292128|| CA20837

Page 31: XML & Web Services

The XML <Labrs3P00 T=" Labrs3P00">

<Labrs3P00. PTP T=" PTP"><PTP. primrPrsnm T=" PN">

<fmn T=" ST"> Sample</ fmn><gvn T=" ST"> George</ gvn><mdn T=" ST"> H</ mdn>

</ PTP. primrPrsnm></ Labrs3P00. PTP><Labrs3P00. SIOO_ L T=" SIOO_ L">

<SIOO_ L. item T=" SIOO"><SIOO. filrOrdId T=" IID"> LABGL110801</ SIOO. filrOrdId><SIOO. placrOrdId T=" IID"> DMCRES387209373</ SIOO. placrOrdId>

<SIOO. InsncOf T=" MSRV"><MSRV. unvSvcId T=" CE"> 18768- 2</ MSRV. unvSvcId><MSRV. svcDesc T=" TX"> CELL COUNTS+ DIFFERENTIAL TESTS (COMPOSITE)</ MSRV.

svcDesc></ SIOO. InsncOf><SIOO. SRVE_ L T=" SRVE_ L"><SRVE_ L. item T=" SRVE">

<SRVE. name T=" CE"> 4544- 3</ SRVE. name><SRVE. svcEvntDesc T=" ST"> HEMATOCRIT (AUTOMATED)</ SRVE. svcEvntDesc><SRVE. CLOB T=" CLOB">

<CLOB. obsvnValu T=" NM"> 45</ CLOB. obsvnValu><CLOB. refsRng T=" ST"> 39- 49</ CLOB. refsRng><CLOB. clnRlvnBgnDtm T=" DTM"> 199812292128</ CLOB. clnRlvnBgnDtm>

</ SRVE. CLOB><SRVE. spcmRcvdDtm T=" DTM"> 199812292315</ SRVE. spcmRcvdDtm>

</ SRVE_ L. item></ SIOO_ L. item>

</ Labrs3P00. SIOO_ L></ Labrs3P00>

Page 32: XML & Web Services

Technology Alphabet SoupHTML, DHTML, CSS, XML, XSL, DOM

HTML & DHMTL

“Format without Structure”

CSS “Enhanced Format, No Structure”

XML “Structure Without Format”

XSL “Adding Format to Structure”

DOM “All Elements Combined”

Page 33: XML & Web Services

Summary

• CSS allows structuring formatting of HTML document• Easy to maintain formatting information

• XML moves web documents into new level• Impose object structure into web documents• Separate presentation from data• Can support multiple presentations for a same set of

data• Document object model (DOM) defines programming

interface for both HTML & XML

Page 34: XML & Web Services

Web Services Overview Evolution of the Web

Generation 1

Static HTML

HTML

Generation 2

Web Applications

HTMLHTML, XML

HTML, XML

Generation 3

Web Services

Page 35: XML & Web Services

Other Web Services

Partner Web Service

Partner Web Service

Data Access and Storage Tier

Application Business Logic Tier

YourCompany.com

Internet + XML

Web Services Overview Application Model

Other Applications

End Users

Page 36: XML & Web Services

Mail

Calendar

News

Finance

Weather

Other

Svcs

Ads

Web Services Overview Portals

Page 37: XML & Web Services
Page 38: XML & Web Services
Page 39: XML & Web Services

Web Services Overview Sample Web Services

• E-commerce: order books, office supplies, other products

• Track packages: UPS, FedEx• Weather• Maps• Telephone redirection, customizable

rules and messages

Page 40: XML & Web Services
Page 41: XML & Web Services

Example Problem Space

ClientPO Service

Credit Service

Inventory Service

Purchase Order

Credit

Check

ReserveInventory

Credit

Response

InventoryResponse

InvoiceConsolidate

Results

Page 42: XML & Web Services

Web Service Demos

• WebMethods.net• http://www.webservicelist.com/• http://www.xmlwebservices.cc/index_

Samples.htm#Top• http://www.asitis.co.uk/web-services/

Page 43: XML & Web Services

Underlying Technologies Web Services Stack

Ubiquitous Communications: Internet

Universal Data Format: XML

Wire Format: Service Interactions: SOAP

Description: Formal Service Descriptions: WSDL

Simple, Open, Broad Industry Support

Directory: Publish & Find Services: UDDI

Inspection: Find Services on server: DISCO

Page 44: XML & Web Services

Underlying Technologies Web Services Stack

Directoryhttp://www.uddi.org

UDDI

DISCO

WSDL

SOAP

Inspectionhttp://www.ibuyspy.com/ibuyspy.disco

Descriptionhttp://www.ibuyspy.com/ibuyspycs/InstantOrder.asmx?wsdl

Wire Format

Locate a Service

Link to Discovery Document (XML)

Request Discovery Document

Return Discovery Document (XML)

Return Service Description (XML)

Return Service Response (XML)

Request Service

Request Service Description

Web

Ser

vice

Clie

nt

UD

DI o

ro

ther

directo

ry service

Web

Service

Page 45: XML & Web Services

• A lightweight protocol for exchanging information in a distributed, heterogeneous environment• It enables cross-platform interoperability

• Interoperable• OS, object model, programming language neutral• Hardware independent• Protocol independent

• Works over existing Internet infrastructure

SOAP Overview

Page 46: XML & Web Services

SOAP Message

SOAP Envelope

SOAP Header

SOAP Body

Message Name & Data

Headers

Headers

XML-encoded SOAP message name & data

<Body> contains SOAP message name

Individual headers

<Header> encloses headers

<Envelope> encloses payload

Protocol binding headers

The complete SOAP message

SOAPMessage Structure

Page 47: XML & Web Services

Marketplace

UDDIThe Vision

Search Portal

Marketplace

Search Portal

Marketplace

Business Users

Advanced Discovery via Portals and Marketplaces

UDDI Registries and Protocol

Technical Users

Page 48: XML & Web Services

UDDIUDDI Information Model

Provider: Information about the entity who offers a service

Service: Descriptive information about a particular family of technical offerings

Binding: Technical information about a service entry point and construction specs

tModel: Descriptions of specifications for services.

Bindings contain references to tModels. These references designate the interface specifications for a service.

0…n

0…n

1…n

Page 49: XML & Web Services

Web Services Overview Technology Fabric Must Span Companies Too

Page 50: XML & Web Services

Underlying Technologies XML Is the Glue

Program the Web

XML

Browse the Web

HTML

TCP/IP

Connect the Web

Technology

Innovation

Connectivity PresentationConnecting ApplicationsFTP, E-mail, Gopher

Web Pages Web Services

Page 51: XML & Web Services

Web Services Growth???

?

Web Services: Standards-based integration and interoperability across platforms, applications, and programming languages

Page 52: XML & Web Services

Underlying Technologies Web Services Stack

Ubiquitous Communications: Internet

Universal Data Format: XML

Wire Format: Service Interactions: SOAP

Description: Formal Service Descriptions: WSDL

Simple, Open, Broad Industry Support

Directory: Publish & Find Services: UDDI

Inspection: Find Services on server: DISCO