modern' xml applications - xml in electronic data ...czarnik/zajecia/xml12/11-en.pdf ·...

83
”Modern” XML applications XML in electronic data interchange, application integration and databases Patryk Czarnik Institute of Informatics University of Warsaw XML and Modern Techniques of Content Management – 2012/13 . . . . . .

Upload: duongcong

Post on 06-Feb-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

”Modern” XML applicationsXML in electronic data interchange,application integration and databases

Patryk Czarnik

Institute of Informatics University of Warsaw

XML and Modern Techniques of Content Management – 2012/13

. . . . . .

Page 2: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

...1 Electronic data interchangeIntroductionPre-XML solutionsXML for EDI

...2 Application integrationIdeaWeb Services

...3 XML and databasesXML support in relational databasesXML databases

. . . . . .

Page 3: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

...1 Electronic data interchangeIntroductionPre-XML solutionsXML for EDI

...2 Application integrationIdeaWeb Services

...3 XML and databasesXML support in relational databasesXML databases

. . . . . .

Page 4: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Electronic data interchange Introduction

Electronic data interchange (EDI) — motivation.Technology..

......

How to interchange data betweencompanies / institutions (B2B)?

paperelectronic data interchange

.Standard deployment levels..

......

software developedaccording to standard frombeginninginterface added to legacysystem

.Protocol..

......

How to establish EDIprotocol?

customer receives(or buys) a toolfrom providersmaller partnercomplies to biggerparterad-hoc createdconversion tools

standard

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 4 / 42

Page 5: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Electronic data interchange Introduction

Electronic data interchange (EDI) — motivation.Technology..

......

How to interchange data betweencompanies / institutions (B2B)?

paperelectronic data interchange

.Standard deployment levels..

......

software developedaccording to standard frombeginninginterface added to legacysystem

.Protocol..

......

How to establish EDIprotocol?

customer receives(or buys) a toolfrom providersmaller partnercomplies to biggerparterad-hoc createdconversion tools

standard

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 4 / 42

Page 6: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Electronic data interchange Introduction

Electronic data interchange (EDI) — motivation.Technology..

......

How to interchange data betweencompanies / institutions (B2B)?

paperelectronic data interchange

.Standard deployment levels..

......

software developedaccording to standard frombeginninginterface added to legacysystem

.Protocol..

......

How to establish EDIprotocol?

customer receives(or buys) a toolfrom providersmaller partnercomplies to biggerparterad-hoc createdconversion toolsstandard

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 4 / 42

Page 7: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Electronic data interchange Pre-XML solutions

EDI standardisation prior to XML introduction.ANSI Accredited Standards Committee X12 sub-group..

......

USA national standardused mainly in America

.EDIFACT..

......

international standard (UN/CEFACT and ISO)used mainly in Europe and Asia

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 5 / 42

Page 8: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Electronic data interchange Pre-XML solutions

EDI standardisation prior to XML introduction.ANSI Accredited Standards Committee X12 sub-group..

......

USA national standardused mainly in America

.EDIFACT..

......

international standard (UN/CEFACT and ISO)used mainly in Europe and Asia

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 5 / 42

Page 9: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Electronic data interchange Pre-XML solutions

EDIFACT characteristic.Format..

......

texthardly readabletree structure

.Predefined dictionaries..

......

193 message types279 segments186 elements

(counted for version 08a, 2008)

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 6 / 42

Page 10: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Electronic data interchange Pre-XML solutions

EDIFACT characteristic.Format..

......

texthardly readabletree structure

.Predefined dictionaries..

......

193 message types279 segments186 elements

(counted for version 08a, 2008)

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 6 / 42

Page 11: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Electronic data interchange Pre-XML solutions

EDIFACT.EDIFACT message example..

......

UNB+IATB:1+6XPPC+LHPPC+940101:0950+1'UNH+1+PAORES:93:1:IA'MSG+1:45'IFT+3+XYZCOMPANY AVAILABILITY'ERC+A7V:1:AMD'IFT+3+NO MORE FLIGHTS'ODI'TVL+240493:1000::1220+FRA+JFK+DL+400+C'PDI++C:3+Y::3+F::1'APD+74C:0:::6++++++6X'TVL+240493:1740::2030+JFK+MIA+DL+081+C'PDI++C:4'APD+EM2:0:1630::6+++++++DA'UNT+13+1'UNZ+1+1'

cite: Wikipedia

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 7 / 42

Page 12: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Electronic data interchange Pre-XML solutions

EDIFACT structureWymiana

(interchange)

Wiadomość(message)

:690

+KGM:690+

MEA+WT+AAD+KGM:690+X5'Segment

Złożenie(composite)

Element(data element)

Grupa(segment group)

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 8 / 42

Page 13: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Electronic data interchange XML for EDI

XML EDIIdea: use XML as data format for EDI

.Traditional EDI..

......

Documents unreadablewithout specificationCompact messagesCentralised standardmaintenanceChanges in formatrequires software changeSpecialised tools needed

.XML EDI..

......

„Self-descriptioning” documentsformatVerbose messages“Pluggable”, flexible standardsWell written software ready toextensions of formatXML-format layer handled bygeneral XML libraries

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 9 / 42

Page 14: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Electronic data interchange XML for EDI

XML EDIIdea: use XML as data format for EDI.Traditional EDI..

......

Documents unreadablewithout specificationCompact messagesCentralised standardmaintenanceChanges in formatrequires software changeSpecialised tools needed

.XML EDI..

......

„Self-descriptioning” documentsformatVerbose messages“Pluggable”, flexible standardsWell written software ready toextensions of formatXML-format layer handled bygeneral XML libraries

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 9 / 42

Page 15: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Electronic data interchange XML for EDI

XML EDI flexibility.Format flexibility..

......

Structures: choosing, repeating, nesting, optionalityFormat extensions and mixing via namespaces

.Applications..

......

Data interchange between partners’ systemsWeb interface (with little help from XSLT)Web Services integration

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 10 / 42

Page 16: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Electronic data interchange XML for EDI

XML EDI flexibility.Format flexibility..

......

Structures: choosing, repeating, nesting, optionalityFormat extensions and mixing via namespaces

.Applications..

......

Data interchange between partners’ systemsWeb interface (with little help from XSLT)Web Services integration

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 10 / 42

Page 17: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Electronic data interchange XML for EDI

XML EDI standardisation.Framework level..

......

general rules for all kinds of datadata of the same kind should be represented in the same way(not to define the same twice)example: Electronic Business XML (ebXML).

.Industry standards (examples)..

......

SWIFT — bankingRosettaNet — trade and logisticAutomotive Industry Action Group — motor industry (mainlyAmerican)Health Level Seven — health careOpen Travel Alliance — (people) transport and tourist services

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 11 / 42

Page 18: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Electronic data interchange XML for EDI

XML EDI standardisation.Framework level..

......

general rules for all kinds of datadata of the same kind should be represented in the same way(not to define the same twice)example: Electronic Business XML (ebXML).

.Industry standards (examples)..

......

SWIFT — bankingRosettaNet — trade and logisticAutomotive Industry Action Group — motor industry (mainlyAmerican)Health Level Seven — health careOpen Travel Alliance — (people) transport and tourist servicesPatryk Czarnik 11 — EDI, WS, databases XML 2012/13 11 / 42

Page 19: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Electronic data interchange XML for EDI

ebXML.ebXML..

......

Set of specifications defining concepts and methodologies forconducting electronic business via Internet (2001)XML used as data format

.Scope of standardisation..

......

Framework levelXML structures (only) for envelopes and common elementsMeans for defining concrete applicationsebXML does not close the set of available elements (like EDIFACTdid)

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 12 / 42

Page 20: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Electronic data interchange XML for EDI

ebXML.ebXML..

......

Set of specifications defining concepts and methodologies forconducting electronic business via Internet (2001)XML used as data format

.Scope of standardisation..

......

Framework levelXML structures (only) for envelopes and common elementsMeans for defining concrete applicationsebXML does not close the set of available elements (like EDIFACTdid)

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 12 / 42

Page 21: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

...1 Electronic data interchangeIntroductionPre-XML solutionsXML for EDI

...2 Application integrationIdeaWeb Services

...3 XML and databasesXML support in relational databasesXML databases

. . . . . .

Page 22: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Idea

XML for application integrationGoal — data interchange between applications

applications/modules/components with different internal formatsXML as interface

Usage:client/server communicationnodes of distributed systemscomponents integrationremote configuration and monitoring of applications. . .

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 14 / 42

Page 23: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Idea

XML for application integrationGoal — data interchange between applications

applications/modules/components with different internal formatsXML as interface

Usage:client/server communicationnodes of distributed systemscomponents integrationremote configuration and monitoring of applications. . .

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 14 / 42

Page 24: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Idea

Local and global applications.“Local” integration..

......

within single project or related projects of single institutioncommunication between componentspossibly in distributed architecturead-hoc solutions for given problemspossibility of using standard

.“Global” integration..

......

services available in Internet for any partydifferent parts cooperationstandardisation requiredmotivation to use Web Services

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 15 / 42

Page 25: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Idea

Local and global applications.“Local” integration..

......

within single project or related projects of single institutioncommunication between componentspossibly in distributed architecturead-hoc solutions for given problemspossibility of using standard

.“Global” integration..

......

services available in Internet for any partydifferent parts cooperationstandardisation requiredmotivation to use Web Services

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 15 / 42

Page 26: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

Web Services.Idea........Web Service — a website for programs (instead of people)

.General definition..

......

communication based onhigh-level protocolsstructural messagesservices describedsearching services

.Concrete definition..

......

“Classical” Web-ServicesHTTP or other protocolsSOAPWSDLUDDI

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 16 / 42

Page 27: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

Web Services.Idea........Web Service — a website for programs (instead of people).General definition..

......

communication based onhigh-level protocolsstructural messagesservices describedsearching services

.Concrete definition..

......

“Classical” Web-ServicesHTTP or other protocolsSOAPWSDLUDDI

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 16 / 42

Page 28: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

Web Services.Idea........Web Service — a website for programs (instead of people).General definition..

......

communication based onhigh-level protocolsstructural messagesservices describedsearching services

.Concrete definition..

......

“Classical” Web-ServicesHTTP or other protocolsSOAPWSDLUDDI

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 16 / 42

Page 29: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

Web Services — typical applicationsProviding data (free or paid):

timetablesweatherstock and currency notes

Services:searchingsoftware updates

Business operation between partnersbooking tickets or hotel roomsordering (and tracing order status)electronic data interchange

E-Administration

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 17 / 42

Page 30: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

Web Services standardisationSOAP (initially “Simple Object Access Protocol”:

beginnings: 1998v1.2: W3C Recommendation, June 2003

Web Services Description Language:v1.1: W3C Note, 2001v2.0: W3C Recommendation, June 2007

Universal Description Discovery and Integration:OASIS projectpart of WS-I Basic Profile

WS-* standards:various standards, usually not W3C:Web Services Interoperability — levels of WS compliance:WS-I Basic Profile, Simple Soap Binding Profile, . . . ,WS-Eventing, WS-Addressing, WS-Routing, WS-Security . . .

Business Process Execution Language (OASIS) — WS semanticsdescription, programming using WS as building blocks

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 18 / 42

Page 31: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

Web Services standardisationSOAP (initially “Simple Object Access Protocol”:

beginnings: 1998v1.2: W3C Recommendation, June 2003

Web Services Description Language:v1.1: W3C Note, 2001v2.0: W3C Recommendation, June 2007

Universal Description Discovery and Integration:OASIS projectpart of WS-I Basic Profile

WS-* standards:various standards, usually not W3C:Web Services Interoperability — levels of WS compliance:WS-I Basic Profile, Simple Soap Binding Profile, . . . ,WS-Eventing, WS-Addressing, WS-Routing, WS-Security . . .

Business Process Execution Language (OASIS) — WS semanticsdescription, programming using WS as building blocks

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 18 / 42

Page 32: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

Web Services standardisationSOAP (initially “Simple Object Access Protocol”:

beginnings: 1998v1.2: W3C Recommendation, June 2003

Web Services Description Language:v1.1: W3C Note, 2001v2.0: W3C Recommendation, June 2007

Universal Description Discovery and Integration:OASIS projectpart of WS-I Basic Profile

WS-* standards:various standards, usually not W3C:Web Services Interoperability — levels of WS compliance:WS-I Basic Profile, Simple Soap Binding Profile, . . . ,WS-Eventing, WS-Addressing, WS-Routing, WS-Security . . .

Business Process Execution Language (OASIS) — WS semanticsdescription, programming using WS as building blocks

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 18 / 42

Page 33: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

Web Services standardisationSOAP (initially “Simple Object Access Protocol”:

beginnings: 1998v1.2: W3C Recommendation, June 2003

Web Services Description Language:v1.1: W3C Note, 2001v2.0: W3C Recommendation, June 2007

Universal Description Discovery and Integration:OASIS projectpart of WS-I Basic Profile

WS-* standards:various standards, usually not W3C:Web Services Interoperability — levels of WS compliance:WS-I Basic Profile, Simple Soap Binding Profile, . . . ,WS-Eventing, WS-Addressing, WS-Routing, WS-Security . . .

Business Process Execution Language (OASIS) — WS semanticsdescription, programming using WS as building blocks

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 18 / 42

Page 34: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

Web Services standardisationSOAP (initially “Simple Object Access Protocol”:

beginnings: 1998v1.2: W3C Recommendation, June 2003

Web Services Description Language:v1.1: W3C Note, 2001v2.0: W3C Recommendation, June 2007

Universal Description Discovery and Integration:OASIS projectpart of WS-I Basic Profile

WS-* standards:various standards, usually not W3C:Web Services Interoperability — levels of WS compliance:WS-I Basic Profile, Simple Soap Binding Profile, . . . ,WS-Eventing, WS-Addressing, WS-Routing, WS-Security . . .

Business Process Execution Language (OASIS) — WS semanticsdescription, programming using WS as building blocksPatryk Czarnik 11 — EDI, WS, databases XML 2012/13 18 / 42

Page 35: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

SOAP — communication protocol

Built on top of underlying transport protocol (HTTP or other)Message format

main message part — XMLenvelope and some special elements defined in stanrdardimplementation-dependend contentadditional atachments in any format (even binary)

Differences to RPC, CORBA, DCOM etc.:data represented in extensible, structural format (XML)data types independent of platform (XML Schema)lower efficiency

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 19 / 42

Page 36: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

SOAP message — general form

. . . . . .

Page 37: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

SOAP messageXML document for a single message

namespace http://www.w3.org/2001/12/soap-envelope,main element: Envelope.

Main parts:header optionalbody required

Restrictions:no DTD (and external entity references)no processing instructions

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 21 / 42

Page 38: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

SOAP messageXML document for a single message

namespace http://www.w3.org/2001/12/soap-envelope,main element: Envelope.

Main parts:header optionalbody required

Restrictions:no DTD (and external entity references)no processing instructions

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 21 / 42

Page 39: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

SOAP messageXML document for a single message

namespace http://www.w3.org/2001/12/soap-envelope,main element: Envelope.

Main parts:header optionalbody required

Restrictions:no DTD (and external entity references)no processing instructions

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 21 / 42

Page 40: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

SOAP header

actor — header receiver identifier (URI), optionalmustUnderstand — must header be understood? (0/1)

.W3Schools example..

......

<?xml version="1.0"?><soap:Envelopexmlns:soap="http://www.w3.org/2001/12/soap-envelope"soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Header><m:Transxmlns:m="http://www.w3schools.com/transaction/"soap:actor="http://www.w3schools.com/appml/"soap:mustUnderstand="1">234</m:Trans></soap:Header>

. . .</soap:Envelope>

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 22 / 42

Page 41: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

SOAP header

actor — header receiver identifier (URI), optional

mustUnderstand — must header be understood? (0/1)

.W3Schools example..

......

<?xml version="1.0"?><soap:Envelopexmlns:soap="http://www.w3.org/2001/12/soap-envelope"soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Header><m:Transxmlns:m="http://www.w3schools.com/transaction/"soap:actor="http://www.w3schools.com/appml/"soap:mustUnderstand="1">234</m:Trans></soap:Header>

. . .</soap:Envelope>

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 22 / 42

Page 42: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

SOAP header

actor — header receiver identifier (URI), optionalmustUnderstand — must header be understood? (0/1)

.W3Schools example..

......

<?xml version="1.0"?><soap:Envelopexmlns:soap="http://www.w3.org/2001/12/soap-envelope"soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Header><m:Transxmlns:m="http://www.w3schools.com/transaction/"soap:actor="http://www.w3schools.com/appml/"soap:mustUnderstand="1">234</m:Trans></soap:Header>

. . .</soap:Envelope>

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 22 / 42

Page 43: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

SOAP body

remote procedure callparametersencodingStyle — data encoding style (URI)

.Request — altered W3Schools example..

......

<soap:Envelopexmlns:soap="http://www.w3.org/2001/12/soap-envelope"soap:encodingStyle="http://www.w3.org/2001/12/literal">

<soap:Body><m:GetPrice xmlns:m="http://www.w3schools.com/prices">

<m:Item>Apples</m:Item><m:Currency>PLN</m:Currency>

</m:GetPrice></soap:Body>

</soap:Envelope>

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 23 / 42

Page 44: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

SOAP body

remote procedure call

parametersencodingStyle — data encoding style (URI)

.Request — altered W3Schools example..

......

<soap:Envelopexmlns:soap="http://www.w3.org/2001/12/soap-envelope"soap:encodingStyle="http://www.w3.org/2001/12/literal">

<soap:Body><m:GetPrice xmlns:m="http://www.w3schools.com/prices">

<m:Item>Apples</m:Item><m:Currency>PLN</m:Currency>

</m:GetPrice></soap:Body>

</soap:Envelope>

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 23 / 42

Page 45: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

SOAP body

remote procedure callparameters

encodingStyle — data encoding style (URI)

.Request — altered W3Schools example..

......

<soap:Envelopexmlns:soap="http://www.w3.org/2001/12/soap-envelope"soap:encodingStyle="http://www.w3.org/2001/12/literal">

<soap:Body><m:GetPrice xmlns:m="http://www.w3schools.com/prices">

<m:Item>Apples</m:Item><m:Currency>PLN</m:Currency>

</m:GetPrice></soap:Body>

</soap:Envelope>

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 23 / 42

Page 46: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

SOAP body

remote procedure callparametersencodingStyle — data encoding style (URI)

.Request — altered W3Schools example..

......

<soap:Envelopexmlns:soap="http://www.w3.org/2001/12/soap-envelope"soap:encodingStyle="http://www.w3.org/2001/12/literal">

<soap:Body><m:GetPrice xmlns:m="http://www.w3schools.com/prices">

<m:Item>Apples</m:Item><m:Currency>PLN</m:Currency>

</m:GetPrice></soap:Body>

</soap:Envelope>

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 23 / 42

Page 47: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

SOAP body

procedure resultoutput parameters

.Response — altered W3Schools example..

......

<soap:Envelopexmlns:soap="http://www.w3.org/2001/12/soap-envelope"soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Body><m:GetPriceResponse xmlns:m="http://www.w3schools.com/prices"><m:Price>1.90</m:Price>

<m:Currency>PLN</m:Currency></m:GetPriceResponse>

</soap:Body>

</soap:Envelope>

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 24 / 42

Page 48: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

SOAP body

procedure result

output parameters

.Response — altered W3Schools example..

......

<soap:Envelopexmlns:soap="http://www.w3.org/2001/12/soap-envelope"soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Body><m:GetPriceResponse xmlns:m="http://www.w3schools.com/prices"><m:Price>1.90</m:Price>

<m:Currency>PLN</m:Currency></m:GetPriceResponse>

</soap:Body>

</soap:Envelope>

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 24 / 42

Page 49: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

SOAP body

procedure resultoutput parameters

.Response — altered W3Schools example..

......

<soap:Envelopexmlns:soap="http://www.w3.org/2001/12/soap-envelope"soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Body><m:GetPriceResponse xmlns:m="http://www.w3schools.com/prices"><m:Price>1.90</m:Price>

<m:Currency>PLN</m:Currency></m:GetPriceResponse>

</soap:Body>

</soap:Envelope>

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 24 / 42

Page 50: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

SOAP — failure message

standard error codeshort text descriptionadditional data (XML)

.Response with failure message..

......

<soap:Envelope xmlns:usos="urn:USOS"xmlns:soap="http://www.w3.org/2001/12/soap-envelope"soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Body><soap:Fault>

<soap:faultcode>Receiver</soap:faultcode><soap:faultstring>Data missing</soap:faultstring><soap:faultdetail>Found no studentidentified with <usos:ind>123</usos:ind></soap:faultdetail>

</soap:Fault></soap:Body>

</soap:Envelope>

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 25 / 42

Page 51: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

SOAP — failure message

standard error code

short text descriptionadditional data (XML)

.Response with failure message..

......

<soap:Envelope xmlns:usos="urn:USOS"xmlns:soap="http://www.w3.org/2001/12/soap-envelope"soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Body><soap:Fault>

<soap:faultcode>Receiver</soap:faultcode><soap:faultstring>Data missing</soap:faultstring><soap:faultdetail>Found no studentidentified with <usos:ind>123</usos:ind></soap:faultdetail>

</soap:Fault></soap:Body>

</soap:Envelope>

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 25 / 42

Page 52: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

SOAP — failure message

standard error codeshort text description

additional data (XML)

.Response with failure message..

......

<soap:Envelope xmlns:usos="urn:USOS"xmlns:soap="http://www.w3.org/2001/12/soap-envelope"soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Body><soap:Fault>

<soap:faultcode>Receiver</soap:faultcode><soap:faultstring>Data missing</soap:faultstring><soap:faultdetail>Found no studentidentified with <usos:ind>123</usos:ind></soap:faultdetail>

</soap:Fault></soap:Body>

</soap:Envelope>

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 25 / 42

Page 53: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

SOAP — failure message

standard error codeshort text descriptionadditional data (XML)

.Response with failure message..

......

<soap:Envelope xmlns:usos="urn:USOS"xmlns:soap="http://www.w3.org/2001/12/soap-envelope"soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Body><soap:Fault>

<soap:faultcode>Receiver</soap:faultcode><soap:faultstring>Data missing</soap:faultstring><soap:faultdetail>Found no studentidentified with <usos:ind>123</usos:ind></soap:faultdetail>

</soap:Fault></soap:Body>

</soap:Envelope>

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 25 / 42

Page 54: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

WSDL — service descriptionXML document describing service(s)

namespace: http://schemas.xmlsoap.org/wsdl/main element: definitions

Splitting into parts available

.WSDL document components..

......

types type definitions (XML Schema)message message type definitions

portType set of operations, which have input and outputmessages

serviceType consists of portType-sbinding service type bound to concrete transport protocolservice concrete service available somewhere

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 26 / 42

Page 55: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

WSDL — service descriptionXML document describing service(s)

namespace: http://schemas.xmlsoap.org/wsdl/main element: definitions

Splitting into parts available.WSDL document components..

......

types type definitions (XML Schema)message message type definitions

portType set of operations, which have input and outputmessages

serviceType consists of portType-sbinding service type bound to concrete transport protocolservice concrete service available somewhere

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 26 / 42

Page 56: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

WSDL — messages, operations, port types.W3Schools example..

......

<message name="getTermRequest"><part name="term" type="xs:string"/>

</message>

<message name="getTermResponse"><part name="value" type="xs:string"/>

</message>

<portType name="glossaryTerms"><operation name="getTerm">

<input message="getTermRequest"/><output message="getTermResponse"/>

</operation></portType>

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 27 / 42

Page 57: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

WSDL — SOAP binging

style rpc or documenttransport transport protocol (URI)

soapAction SOAP-Action header corresponding to WSDL operation

.W3Schools example..

......

<binding type="glossaryTerms" name="b1"><soap:binding style="document"transport="http://schemas.xmlsoap.org/soap/http" />

<operation><soap:operation

soapAction="http://example.com/getTerm"/><input> <soap:body use="literal"/> </input><output> <soap:body use="literal"/> </output>

</operation></binding>

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 28 / 42

Page 58: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

WSDL — SOAP binging

style rpc or document

transport transport protocol (URI)soapAction SOAP-Action header corresponding to WSDL operation

.W3Schools example..

......

<binding type="glossaryTerms" name="b1"><soap:binding style="document"transport="http://schemas.xmlsoap.org/soap/http" />

<operation><soap:operation

soapAction="http://example.com/getTerm"/><input> <soap:body use="literal"/> </input><output> <soap:body use="literal"/> </output>

</operation></binding>

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 28 / 42

Page 59: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

WSDL — SOAP binging

style rpc or documenttransport transport protocol (URI)

soapAction SOAP-Action header corresponding to WSDL operation

.W3Schools example..

......

<binding type="glossaryTerms" name="b1"><soap:binding style="document"transport="http://schemas.xmlsoap.org/soap/http" />

<operation><soap:operation

soapAction="http://example.com/getTerm"/><input> <soap:body use="literal"/> </input><output> <soap:body use="literal"/> </output>

</operation></binding>

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 28 / 42

Page 60: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

WSDL — SOAP binging

style rpc or documenttransport transport protocol (URI)

soapAction SOAP-Action header corresponding to WSDL operation.W3Schools example..

......

<binding type="glossaryTerms" name="b1"><soap:binding style="document"transport="http://schemas.xmlsoap.org/soap/http" />

<operation><soap:operation

soapAction="http://example.com/getTerm"/><input> <soap:body use="literal"/> </input><output> <soap:body use="literal"/> </output>

</operation></binding>

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 28 / 42

Page 61: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

Service registration and discovery.Idea..

......

service provider registers serviceuser searches for service and finds it in registry

.Universal Description Discovery and Integration (UDDI)..

......

available as service (SOAP)business category-based directory (“yellow pages”)searching basing on service name, description (“white pages”)registration and updates for service providers

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 29 / 42

Page 62: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

Service registration and discovery.Idea..

......

service provider registers serviceuser searches for service and finds it in registry

.Universal Description Discovery and Integration (UDDI)..

......

available as service (SOAP)business category-based directory (“yellow pages”)searching basing on service name, description (“white pages”)registration and updates for service providers

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 29 / 42

Page 63: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

UDDI — issues.Main issue — who can register?..

......

anybody — chaos and low reliabilityaccepted partners — institution responsible for access policyneeded, no such (widely accepted) institution exists

.Reality..

......

UDDI rarely usedif ever — for “local” SOA-based solutions (intranets)

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 30 / 42

Page 64: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

UDDI — issues.Main issue — who can register?..

......

anybody — chaos and low reliabilityaccepted partners — institution responsible for access policyneeded, no such (widely accepted) institution exists

.Reality..

......

UDDI rarely usedif ever — for “local” SOA-based solutions (intranets)

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 30 / 42

Page 65: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

Service Oriented Architecture.Idea..

......

services built basing on other serviceseven addition defined as a Web Service :)

software split into components and layers with WS interfacesbetween themprecise specification required (interesting research field. . . )

.Critique..

......

modular, flexible, and scalable solutionsby the cost of (sometimes) irrational inefficiency and complexityuse reasonably!

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 31 / 42

Page 66: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

Service Oriented Architecture.Idea..

......

services built basing on other serviceseven addition defined as a Web Service :)

software split into components and layers with WS interfacesbetween themprecise specification required (interesting research field. . . )

.Critique..

......

modular, flexible, and scalable solutionsby the cost of (sometimes) irrational inefficiency and complexityuse reasonably!

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 31 / 42

Page 67: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

Are WebServices good or bad?

It depends on actual problem, of course..Web Service recommended..

......

Many partners or public service (standardisation)Heterogeneous architectureText and structural data already present in problem domainFlexibility more important than efficiency

.Web Service?... not necessarily..

......

Internal, homogeneous solution.Binary and flat dataEfficiency more important than flexibility

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 32 / 42

Page 68: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

Application integration Web Services

Are WebServices good or bad?

It depends on actual problem, of course..Web Service recommended..

......

Many partners or public service (standardisation)Heterogeneous architectureText and structural data already present in problem domainFlexibility more important than efficiency

.Web Service?... not necessarily..

......

Internal, homogeneous solution.Binary and flat dataEfficiency more important than flexibility

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 32 / 42

Page 69: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

...1 Electronic data interchangeIntroductionPre-XML solutionsXML for EDI

...2 Application integrationIdeaWeb Services

...3 XML and databasesXML support in relational databasesXML databases

. . . . . .

Page 70: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

XML and databases

XML support in databases — categorisation.Classic (usually relational) database with XML support..

......

logical structure — relations and referencesadditional XML-related featuresused for application integration or storing XML data as part oflarger data structures

.XML database..

......

logical structure — XML document treeXQuery (or XPath) as native query languagenatural XML-related featuresused for storing XML data (or structural data easily mapped toXML tree)

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 34 / 42

Page 71: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

XML and databases

XML support in databases — categorisation.Classic (usually relational) database with XML support..

......

logical structure — relations and referencesadditional XML-related featuresused for application integration or storing XML data as part oflarger data structures

.XML database..

......

logical structure — XML document treeXQuery (or XPath) as native query languagenatural XML-related featuresused for storing XML data (or structural data easily mapped toXML tree)

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 34 / 42

Page 72: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

XML and databases XML support in relational databases

XML support in relational databases.Possible functionalities..

......

data import and export in XML formatspecial treatment of XML data stored in fields

XML validation as part of integrity constraints checkingXPath or XQuery for querying fields content

XSLT applied to query results

.How to store XML data..

......

whole document (fragment) stored in single fieldsplit into prima factors

each XML node in separate fieldtables structure reflects tree structure of XML

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 35 / 42

Page 73: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

XML and databases XML support in relational databases

Example — XML support in Oracle database

Since Oracle 8i (http://www.oracle.com/xml).XML parsers

for database programming (PL/SQL)or middleware programming (Java, C++)

XML-SQL UtilityXML data import and export

XMLType data type

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 36 / 42

Page 74: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

XML and databases XML support in relational databases

XML-SQL Utility.getXML() function — XML data export..

......

SELECT xmlgen.getXML(’select * from emp’) FROM dual;

<rowset><row id=”1”><empno>10</empno><name>Scott Tiger</name><title>specialist</title>

</row>...

</rowset>

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 37 / 42

Page 75: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

XML and databases XML support in relational databases

XML support in database engines.Substantial support..

......

DB2, IBM (since version 9 — pureXML)Oracle (since 8i)Microsoft SQL Server (od wersji 2000)Sybase ASE 12.5

.Minimal support..

......

MySQL (XPath queries over text fields containing XML)PostgreSQL???

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 38 / 42

Page 76: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

XML and databases XML support in relational databases

XML support in database engines.Substantial support..

......

DB2, IBM (since version 9 — pureXML)Oracle (since 8i)Microsoft SQL Server (od wersji 2000)Sybase ASE 12.5

.Minimal support..

......

MySQL (XPath queries over text fields containing XML)PostgreSQL???

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 38 / 42

Page 77: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

XML and databases XML databases

“XML datbase”Logical layer

XML document as basic data entityXML schema (or equivalent) as structure definitionXQuery (or XPath) as “native” query languagedocument collections

Physical layernot necessarily files with XML documents

More than just XML files:updates interfacetransactions and concurrent accesssecurity

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 39 / 42

Page 78: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

XML and databases XML databases

“XML datbase”Logical layer

XML document as basic data entityXML schema (or equivalent) as structure definitionXQuery (or XPath) as “native” query languagedocument collections

Physical layernot necessarily files with XML documents

More than just XML files:updates interfacetransactions and concurrent accesssecurity

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 39 / 42

Page 79: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

XML and databases XML databases

“XML datbase”Logical layer

XML document as basic data entityXML schema (or equivalent) as structure definitionXQuery (or XPath) as “native” query languagedocument collections

Physical layernot necessarily files with XML documents

More than just XML files:updates interfacetransactions and concurrent accesssecurity

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 39 / 42

Page 80: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

XML and databases XML databases

XML:DB

Initiative for XML database interfaces specificationXML Database API (XAPI)

accessing XML databases from programsresource collections (resource = XML document)reading and writing documents via DOM or SAXpluggable “services”; specified: XPath, transactions, operationson collectionslast version: 2001

XML Update Language (XUpdate)XML application for updating XML databasesinserting, updating and removing nodesXPath used for node addressinglast version: 2000

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 40 / 42

Page 81: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

XML and databases XML databases

XML:DB

Initiative for XML database interfaces specificationXML Database API (XAPI)

accessing XML databases from programsresource collections (resource = XML document)reading and writing documents via DOM or SAXpluggable “services”; specified: XPath, transactions, operationson collectionslast version: 2001

XML Update Language (XUpdate)XML application for updating XML databasesinserting, updating and removing nodesXPath used for node addressinglast version: 2000

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 40 / 42

Page 82: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

XML and databases XML databases

XUpdate — example.Example (from standard documentation)..

......

<?xml version="1.0"?><xupdate:modifications version="1.0"

xmlns:xupdate="http://www.xmldb.org/xupdate">

<xupdate:insert-after select="/addresses/address[1]" >

<xupdate:element name="address"><xupdate:attribute name="id">2</xupdate:attribute><fullname>Lars Martin</fullname><born day='2' month='12' year='1974'/><town>Leizig</town><country>Germany</country>

</xupdate:element>

</xupdate:insert-after></xupdate:modifications>

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 41 / 42

Page 83: Modern' XML applications - XML in electronic data ...czarnik/zajecia/xml12/11-en.pdf · Electronicdatainterchange Introduction Electronicdatainterchange(EDI)—motivation. Technology

. . . . . .

XML and databases XML databases

XML databases — overviewproduct licence queries XML:DB APIApache XIndice open source XPath yesBaseX open source XPath, XQuery yeseXist open source XPath, XQuery partSedna open source XPath, XQuery yesTamino paid XQuery, XPath partGemfire Enterprise paid XQuery, OQL yes

cite: Wikipedia and providers’ websites

Patryk Czarnik 11 — EDI, WS, databases XML 2012/13 42 / 42