Title: XML ja WSDL
1XML ja WSDL
- Enn Õunapuu
- Tallinn University of Technology
- enn_at_cc.ttu.ee
- 372 050 97720
2Sisu
- XML standard
- XML documents
- XML DOM
- XML document views. CSS,XSL
- WSDL
3Global Virtual Marketplace
- The Global Virtual Market is millions of
consumers, companies and value added services,
applications for healthcare, design and
manufacturing, training and education, retailing
and other key vertical market segments. As with
the Internet itself, the virtual marketplace is
the collective product of many individuals and
organizations that cooperate to build it and
compete on the products and services sold in it.
The result is an entrepreneurial explosion of
applications and services, building on and adding
value to each other.
4XML
- WWW.w3.org based standard.
- Fixes the structure of XML document
- Repository the definitions of documents
- ebXML, RosettaNet, Biztalk
5Mis on XML?
- XML is the Extensible Markup Language. It is
designed to improve the functionality of the Web
by providing more flexible and adaptable
information identification. - It is called extensible because it is not a fixed
format like HTML (a single, predefined markup
language). Instead, XML is actually a
metalanguage' a language for describing other
languageswhich lets you design your own
customized markup languages for limitless
different types of documents. XML can do this
because it's written in SGML, the international
standard metalanguage for text markup systems
(ISO 8879).
6XML example
- HTML text
- Te võiksite vaadata Mark Wilson raamatut XML and
the Internet for Visual Basic 6 Manningsi
kodulehel. Vaadake autori publikatsioonide
jaotist author online section. Et saada kontakti
teiste Visual Basic huvilistega minge
http//www.vbxml.com - XML text
- ltreview subject-type"book"gt Te võiksite vaadata
ltAUTHORgtMark Wilsonlt/AUTHORgt raamatut
ltBOOK_NAMEgtXML and the Internet for Visual Basic
6lt/BOOK_NAMEgt ltPUBLISHERgtManningsilt/PUBLISHERgt
kodulehel. Vaadake autori publikatsioonide
jaotist ltLINK_AREAgt author online
sectionlt/LINK_AREAgt. Et saada kontakti teiste
ltUSER_TOPICgtVisual Basic lt/USER_TOPICgt
huvilistegaltBOOK_TOPICgtXMLlt/BOOK_TOPICgt , minge
ltURLgthttp//www.vbxml.comlt/URLgt lt/review
subject-type"book"gt.
7DTD
XML Schema
XML Data Types
XML
XSL
CSS
Application
XPL
XLL
HTML
XML
Resources
8Xml ülevaade
www.w3.org/xml SGML näide ltEMailgt ltsendergt
ltpersongt ltfirstnamegt Karen
lt/firstnamegt ltlastnamegt Lemone
lt/lastnamegt lt/persongt ltreceivergt
ltpersongt ltdistributionListgt
cs525_at_cs lt/distributionListgt lt/persongt
lt/receivergt ltcontentsgt Don't you
agree this is really ugly? lt/contentsgt lt/EMailgt
9DTD
lt!ELEMENT note (to,from,heading,body)gt lt!ELEMENT
to (PCDATA)gt lt!ELEMENT from (PCDATA)gt
lt!ELEMENT heading (PCDATA)gt lt!ELEMENT body
(PCDATA)gt
10XML SCHEMA
- defines elements that can appear in a document
- defines attributes that can appear in a document
- defines which elements are child elements
- defines the order of child elements
- defines the number of child elements
- defines whether an element is empty or can
include text - defines data types for elements and attributes
- defines default and fixed values for elements and
attributes
11XML SCHEMA vs DTD
- XML Schemas are extensible to future additions
- XML Schemas are richer and more useful than DTDs
- XML Schemas are written in XML
- XML Schemas support data types
- XML Schemas support namespaces
12XML schema elements
- An XML Schema
- defines elements that can appear in a document
- defines attributes that can appear in a document
- defines which elements are child elements
- defines the order of child elements
- defines the number of child elements
- defines whether an element is empty or can
include text - defines data types for elements and attributes
- defines default and fixed values for elements and
attributes
13Well-formed xml document
- A well-formed XML document is a document that
conforms to the XML syntax rules - must begin with the XML declaration
- must have one unique root element
- all start tags must match end-tags
- XML tags are case sensitive
- all elements must be closed
- all elements must be properly nested
- all attribute values must be quoted
- XML entities must be used for special characters
14Simple XML schema
- lt?xml version"1.0"?gt ltxsschema
xmlnsxs"http//www.w3.org/2001/XMLSchema"
targetNamespace"http//www.w3schools.com"
xmlns"http//www.w3schools.com"
elementFormDefault"qualified"gt - ltxselement name"note"gt
- ltxscomplexTypegt
- ltxssequencegt
- ltxselement name"to" type"xsstring"/gt
- ltxselement name"from"
type"xsstring"/gt - ltxselement name"heading"
type"xsstring"/gt - ltxselement name"body"
type"xsstring"/gt - lt/xssequencegt
- lt/xscomplexTypegt
- lt/xselementgt
- lt/xsschemagt
15A Reference to an XML Schema
- lt?xml version"1.0"?gtltnote xmlns"http//www.w3sch
ools.com" xmlnsxsi"http//www.w3.org/2001/XMLSch
ema-instance" xsischemaLocation"http//www.w3sch
ools.com note.xsd"gt - lttogtTovelt/togt
- ltfromgtJanilt/fromgt
- ltheadinggtReminderlt/headinggt
- ltbodygtDon't forget me this weekend!lt/bodygt
- lt/notegt
16Schema
- lt?xml version"1.0"?gt
- ltxsschema xmlnsxs"http//www.w3.org/2001/XMLS
chema" targetNamespace"http//www.w3schools.com"
xmlns"http//www.w3schools.com"
elementFormDefault"qualified"gt - ... ...
- lt/xsschemagt
17Simple element
- ltxselement name"xxx" type"yyy"/gt
- Example
- ltxselement name"lastname" type"xsstring"/gt
- ltxselement name"age" type"xsinteger"/gt
- ltxselement name"dateborn" type"xsdate"/gt
18Common XML Schema Data Types
- xsstring
- xsdecimal
- xsinteger
- xsboolean
- xsdate
- xstime
- ltxselement name"color" type"xsstring"
default"red"/gt
19How to Define an Attribute
- ltxsattribute name"xxx" type"yyy"/gt
- ltxsattribute name"lang" type"xsstring"
default"EN"/gt - ltxsattribute name"lang" type"xsstring"
use"optional"/gt - ltxsattribute name"lang" type"xsstring"
use"required"/gt
20Restrictions on Values
- ltxselement name"car"gt
- ltxssimpleTypegt
- ltxsrestriction base"xsstring"gt
ltxsenumeration value"Audi"/gt ltxsenumeration
value"Golf"/gt ltxsenumeration value"BMW"/gt
lt/xsrestrictiongt - lt/xssimpleTypegt
- lt/xselementgt
21Complex Element
- A complex element is an XML element that contains
other elements and/or attributes. - There are four kinds of complex elements
- empty elements
- elements that contain only other elements
- elements that contain only text
- elements that contain both other elements and
text - Note Each of these elements may contain
attributes as well!
22Complex element example
- ltxselement name"employee"gt ltxscomplexTypegt
- ltxssequencegt
- ltxselement name"firstname"
type"xsstring"/gt - ltxselement name"lastname"
type"xsstring"/gt - lt/xssequencegt
- lt/xscomplexTypegt
- lt/xselementgt
23Cardinality
- ltxselement name"person"gt
- ltxscomplexTypegt
- ltxssequencegt
- ltxselement name"full_name"
type"xsstring"/gt ltxselement name"child_name"
type"xsstring" maxOccurs"10" minOccurs"0"/gt - lt/xssequencegt
- lt/xscomplexTypegt
- lt/xselementgt
24Attribute groups
- ltxsattributeGroup name"personattrgroup"gt
ltxsattribute name"firstname" type"xsstring"/gt
ltxsattribute name"lastname" type"xsstring"/gt
ltxsattribute name"birthday" type"xsdate"/gt
lt/xsattributeGroupgt - ltxselement name"person"gt
- ltxscomplexTypegt
- ltxsattributeGroup ref"personattrgroup"/gt
lt/xscomplexTypegt - lt/xselementgt
25XML Schema example
- http//www.w3.org/TR/2001/REC-xmlschema-0-20010502
/po.xml
26DOM
The Document Object Model is a platform- and
language-neutral interface that will allow
programs and scripts to dynamically access and
update the content, structure and style of
documents. The document can be further processed
and the results of that processing can be
incorporated back into the presented page. This
is an overview of DOM-related materials here at
W3C and around the web.
27(No Transcript)
28XPATH
lt?xml version"1.0" encoding"ISO-8859-1"?gt
ltcataloggt ltcd country"USA"gt lttitlegtEmpire
Burlesquelt/titlegt ltartistgtBob Dylanlt/artistgt
ltpricegt10.90lt/pricegt lt/cdgt ltcd country"UK"gt
lttitlegtHide your heartlt/titlegt ltartistgtBonnie
Tylerlt/artistgt ltpricegt9.90lt/pricegt lt/cdgt ltcd
country"USA"gt lttitlegtGreatest Hitslt/titlegt
ltartistgtDolly Partonlt/artistgt ltpricegt9.90lt/pricegt
lt/cdgt lt/cataloggt /catalog /catalog/cdpricegt10.80
29Web Services
Java ja ASP SOAP Web rakendus
30SOAP Request Näide
ltSOAP-Envelope xmlnsSOAP-ENVhttp//schemas.xmlso
ap.org/soap/envelopegt ltSOAP-Bodygt ltmGetAddress
xmlnsmhttp//example.org/GetAddressgt
ltparametersgt
ltparam0gtStevelt/param0gt
ltparam1gtWattlt/param1gt lt/parametersgt
lt/mGetAddressgt lt/SOAP-Bodygt lt/SOAP-Envelopegt
31The SOAP Response Example
ltSOAP-Envelope xmlnsSOAP-ENVhttp//schemas.xmlso
ap.org/soap/envelopegt ltSOAP-Bodygt
ltmGetAddress xmlnsmhttp//example.org/GetAddres
sgt ltresultsgt
ltresult0gt12th Floor, Ali Reza Towers, Medinah Rd,
Jeddah, KSA lt/result0gt
lt/resultsgt lt/mGetAddressgt lt/SOAP-Bodygt lt/
SOAP-Envelopegt
32WSDL
- Abstract Definitions
- TypesMachine- and language-independent type
definitions. - MessagesContains function parameters (inputs
separate from outputs) or document descriptions. - PortTypesRefers to message definitions in
Messages section to describe function signatures
(operation name, input parameters, output
pameters). - Concrete Descriptions
- Bindings Specifies binding(s) of each operation
in the PortTypes section. - Services Specifies port address(es) of each
binding.
33(No Transcript)
34Message
- ltmessage namequoteRequestgt
- ltpart namebody elementquote-schema-nssto
ckName/gt - lt/messagegt
- ltmessage namequoteResponsegt
- ltpart namebody elementquote-schema-nssto
ckPrice/gt - lt/messagegt
35Porttype
- ltportType namequotePortTypegt
- ltoperation namegetQuotegt
- ltinput messagequote-wsdl-nsquoteReques
t/gt - ltoutput messagequote-wsdl-nsquoteResponse/gt
- lt/operationgt lt/portTypegt
36Binding
- ltbinding namequoteBinding typequote-wsdl-nsq
uotePortTypegt - ltoperation namegetQuotegt
- ltsoapoperation soapAction"http//example.
com/stockQuoteAction"/gt ltinputgt - ltsoapbody partbody useliteral/gt
- lt/inputgt
- ltoutputgt
- ltsoapbody partbody useliteral/gt
- lt/outputgt
- lt/operationgt
- lt/bindinggt
37Service
- ltservice namestockServicegt
- ltport namestockPort bindingquote-wsdl-ns
quoteBindinggt ltsoapaddress
locationhttp//example.com/quotes/'/gt lt/portgt - lt/servicegt
38Questions?