Title: Practical Applications of XML Technologies
1Practical Applications of XML Technologies
- Foundations of Web Services
- WSDL
- Irena Mlýnková
- Martin NecaskĂ˝
- Dept. of Software Engineering
- Faculty of Mathematics and Physics
- Charles University, Prague, Czech Republic
2WSDL Basics
- Web Services Description Language
- language for describing web service interfaces
- current version 2.0
- http//www.w3.org/TR/wsdl20-primer
- editors
- David Booth, HP
- Canyang Kevin Liu, SAP Labs
3WSDL BasicsConceptual Structure
Service
4WSDL BasicsConceptual Structure
Interface
Implementation
5WSDL BasicsConceptual Structure
Interface
Operation A
Implementation
Operation B
Operation C
6WSDL BasicsConceptual Structure
Interface
ReserveFlight
Implementation
ConfirmFlight
CheckInFlight
7WSDL BasicsConceptual Structure
- WSDL allows describing of
- interfaces of web services
- where web services implementing these interfaces
can be accessed and how - web service
- implements interface composed of one or more
abstract interfaces - can be accessed at various places in different
ways - SOAP, HTTP,
8WSDL BasicsConceptual Structure
SOAP1.2 Endpoint
Abstract Interface ManageCustomer
Service Interface
Abstract Interface ProcessPurchase A
HTTP GET Endpoint
Abstract Interface ProcessPurchase B
HTTP POST Endpoint
9WSDL BasicsConceptual Structure
Service Description
Abstract Description
Message
Operation
Interface
Concrete Description
Binding
Service
Endpoint
10WSDL BasicsSyntactical Structure
- root element description
- container for
- abstract definition components
- type system
- element types
- abstract interface
- element interface
11WSDL BasicsSyntactical Structure
- and for
- concrete definition components
- service description
- element service
- binding between service and interface
- element binding
12WSDL BasicsElement description
lt?xml version"1.0" encoding"utf-8"
?gt ltdescription xmlns"http//www.w3.org/ns/wsdl"gt
ltdocumentationgt ... lt/documentationgt
lt!- type system --gt lttypesgt ... lt/typesgt
lt! WSDL 2.0 components --gt ltinterfacegt ...
lt/interfacegt ltbindinggt ... lt/bindinggt
ltservicegt ... lt/servicegt lt/descriptiongt
13WSDL BasicsElement description
DEMO
14WSDL Type System
15WSDL BasicsConceptual Structure
Service Description
Abstract Description
Message
Operation
Interface
Concrete Description
Binding
Service
Endpoint
16WSDL Type SystemElement types
- describes formats for XML messages send and
received by web service - any XML schema language with XML syntax can be
applied inside - XML Schema, Relax NG, Schematron, etc.
- we (and many others) consider XML Schema
- XML Schema should be already known for you
- non-XML type system can be applied as well
17WSDL Type SystemElement types
lt?xml version"1.0" encoding"utf-8"
?gt ltdescription xmlns"http//www.w3.org/ns/wsdl"gt
ltdocumentationgt ... lt/documentationgt
lt!- type system --gt lttypesgt ... lt/typesgt
lt! WSDL 2.0 components --gt ltinterfacegt ...
lt/interfacegt ltbindinggt ... lt/bindinggt
ltservicegt ... lt/servicegt lt/descriptiongt
18WSDL Type SystemElement types
DEMO
19WSDL Abstract Interfaces
20WSDL BasicsConceptual Structure
Service Description
Abstract Description
Message
Operation
Interface
Concrete Description
Binding
Service
Endpoint
21WSDL Abstract Interfaces
- service description contains one or more abstract
interfaces - each specified by element interface
- abstract interface encapsulates set of
- supported operations
- faults reported by operations
- describes functionality only in abstract way
- no concrete details of how and where that
functionality is offered and implemented
22WSDL Abstract InterfacesElement interface
lt?xml version"1.0" encoding"utf-8"
?gt ltdescription xmlns"http//www.w3.org/ns/wsdl"gt
ltdocumentationgt ... lt/documentationgt
lt!- type system --gt lttypesgt ... lt/typesgt
lt! WSDL 2.0 components --gt ltinterfacegt ...
lt/interfacegt ltbindinggt ... lt/bindinggt
ltservicegt ... lt/servicegt lt/descriptiongt
23WSDL Abstract InterfacesElement interface
- attributes
- name
- unique among all abstract interfaces within
containing description - child elements
- optional documentation
- one or more (in any order)
- fault defines fault
- operation defines operation
24WSDL Abstract InterfacesElement interface
DEMO
25WSDL Abstract InterfacesElement interface/fault
- specifies fault message that may occure during
execution of any operation within containing
interface - referenced from operations within interface that
may report that fault - similar to ordinary messages but handled slightly
differently - disturbt normal message flow
- binding to underlying communication protocol
(e.g. SOAP) may be different
26WSDL Abstract InterfacesElement interface/fault
- attributes
- required name
- unique within parent interface
- referenced from operations in same parent
interface - optional element
- content model of fault message
- name of element defined in type system of web
service description
27WSDL Abstract InterfacesElement interface/fault
DEMO
28WSDL Abstract InterfacesElement
interface/operation
- operation provided by containing interface
- specifies message interaction with service via
that operation - set of ordinary and fault messages exchanged
between service and other parties - associated with message exchange pattern (MEP)
- MEP describes ordering and cardinality of
messages within interaction via operation
29WSDL Abstract InterfacesElement
interface/operation
- attributes
- required name
- unique within parent interface
- required pattern
- xsanyURI
- identifies desired MEP for operation
30WSDL Abstract InterfacesElement
interface/operation
- attributes
- optional style
- xsanyURI
- identifies set of rules followed in defining
operation - e.g. "http//www.w3.org/ns/wsdl/rpc" for
RPC-style operations
31WSDL Abstract InterfacesElement
interface/operation
DEMO
32WSDL Abstract InterfacesMore on Message Exchange
Patterns
- define sequence and cardinality of abstract
messages in operation - each abstract message is represented by
placeholder - placeholder is identified by its role and has
direction ("in" or "out") - placeholders associated with specific message
types when operation with that MEP is defined - minimal contract
- other messages not specified by MEP may be sent
during interaction
33WSDL Abstract InterfacesMore on Message Exchange
Patterns
- 8 predefined MEPs in Working Draft 27 March 2006
- in-bound MEPs
- service receives first message in interaction
- In-Only, Robust In-Only, In-Out,
- In-Optional-Out
- out-bound MEPs
- service sends first message in interaction
- Out-Only, Robust Out-Only, Out-In,
- Out-Optional-In
- only three predefined MEPs in Recommendation 26
June 2007 - In-Only, Robust In-Only, In-Out
- however, primer speaks about 8 MEPs
34WSDL Abstract InterfacesMore on Message Exchange
Patterns
- only three predefined MEPs in Recommendation 26
June 2007 - In-Only
- Robust In-Only
- In-Out
- however, primer of that version speaks about 8
MEPs - version inconsistency?
35WSDL Abstract InterfacesMore on Message Exchange
Patterns
- In-Out
- "http//www.w3.org/ns/wsdl/in-out"
- consists of exactly two placeholders
- placeholder
- message label "In", direction "in"
- sent from some node N
- placeholder
- message label "Out", direction "out"
- sent back to N
36WSDL Abstract InterfacesMore on Message Exchange
Patterns
- In-Only
- "http//www.w3.org/ns/wsdl/in-only"
- consists of exactly one placeholder
- placeholder
- message label "In", direction "in"
- sent from some node N
37WSDL Abstract InterfacesMore on Message Exchange
Patterns
- Robust In-Only
- "http//www.w3.org/ns/wsdl/in-only"
- consists of exactly one placeholder
- placeholder
- message label "In", direction "in"
- sent from some node N
- difference between In-Only and Robust In-Only is
in Fault Propagation Rule applied
38WSDL Abstract InterfacesMore on Fault
Propagation Rules
- rules indicating where faults can occur in
interaction specified by MEP - Fault Replaces Message
- any ordinary message after the first one can be
replaced with fault message - fault message must have identical direction as
replaced message and must be delivered to same
target as replaced message - if there is no path to target node, fault must be
discarded - http//www.w3.org/ns/wsdl/fault-replaces-message
- applied by In-Out MEP
39WSDL Abstract InterfacesMore on Fault
Propagation Rules
- Message Triggers Fault
- any ordinary message including the first can
trigger fault message - fault message must have opposite direction to the
ordinary message and must be delivered to the
originator of the ordinary message - if there is no path to the originator, fault must
be discarded - http//www.w3.org/ns/wsdl/message-triggers-fault
- applied by Robust In-Only MEP
40WSDL Abstract InterfacesMore on Fault
Propagation Rules
- No Faults
- faults must not be propagated
- http//www.w3.org/ns/wsdl/no-faults
- applied by In-Only MEP
41WSDL Abstract InterfacesMore on Operation Styles
- specifies additional information about operation
- may define various constraints
- e.g. structural constraints on element
declarations specifying content models of
messages of operation - particular operation style identified by IRI
- three predefined operation styles in WSDL 2.0
- http//www.w3.org/ns/wsdl/style/rpc
- http//www.w3.org/ns/wsdl/style/iri
- http//www.w3.org/ns/wsdl/style/multipart
42WSDL Abstract InterfacesMore on Operation Styles
- http//www.w3.org/ns/wsdl/style/rpc
- restrictions on message content models to allow
RPC-based communication - http//www.w3.org/ns/wsdl/style/iri
- restrictions on message content models when HTTP
is applied as network communication protocol - allows serialization of messages to HTTP
requests/response with GET/POST/PUT/DELETE HTTP
methods - e.g. GET does not allow HTTP message body and
everything must be encoded into HTTP message
header and/or HTTP request query
43WSDL Abstract InterfacesElement
interface/operation
- ordinary messages specified by child elements
- input, output
- fault messages specified by child elements
- infault, outfault
- any number of ordinary and fault messages in any
order - restricted by associated MEP
44WSDL Abstract InterfacesElement
interface/operation/inputoutput
- specifies one ordinary input/output message
- attributes
- optional messageLabel
- xsNCName
- identifies role the message plays in MEP
- unique within containing operation
- predefined values "In", "Out"
- not necessary when standard MEP is applied
45WSDL Abstract InterfacesElement
interface/operation/inputoutput
- attributes
- required element
- union of xstoken and xsQName
- specifies message content model
- values
- any any single element
- none no content
- other content is described by extension
property that references non-XML content
declaration - reference to element declared in type system
46WSDL Abstract InterfacesElement
interface/operation/inputoutput
DEMO
47WSDL Abstract InterfacesElement
interface/operation/infaultoutfault
- specifies one fault input/output message
- attributes
- optional messageLabel
- xsNCName
- identifies role the message plays in MEP
- unique within containing operation
- predefined values "In", "Out"
- not necessary when standard MEP is applied
48WSDL Abstract InterfacesElement
interface/operation/infaultoutfault
- attributes
- required ref
- xsQName
- reference to abstract fault within containing
interface - specifies fault content model
- allows reusability of faults within the interface
49WSDL Abstract InterfacesElement
interface/operation/infaultoutfault
DEMO
50WSDL Abstract InterfacesImports
- XSD element import can be used for importing
external XML schemas into type system - attributes namespace and schemaLocation
- WSDL element import can be used for importing
external WSDL descriptions - attributes namespace and schemaLocation
- attribute extends of element interface that
allows extending external interfaces - list of xsQName
51WSDL Abstract InterfacesImports
DEMO
52WSDL Abstract Interfaces
- "not-yet-picked" "low-hanging" fruit for
interoperability efforts - service can be bounded to more abstract
interfaces - abstract interface can be defined separately from
web service itself
53WSDL Abstract Interfaces
- Real-world scenario 1
- two standardization organizations
- each defining own standardized abstract interface
for processing purchase orders - each has own type system, abstract operations and
faults - concrete purchase order processing web service
supports three abstract interfaces - one own abstract interface
- two standardized interfaces
54WSDL Abstract Interfaces
- Real-world scenario 2
- party understands standardized abstract interface
for purchasing flights - it is necessary to find all services that support
that abstract interface
55WSDL Bindings
56WSDL BasicsConceptual Structure
Service Description
Abstract Description
Message
Operation
Interface
Concrete Description
Binding
Service
Endpoint
57WSDL Bindings
- service description contains one or more bindings
- each specified by element binding
- binding supplies protocol and encoding details to
given abstract interface - implementation details needed to access service
via that interface - for each particular protocol there is binding
extension - two predefined binding extensions in WSDL 2.0
- SOAP and HTTP
- other binding extensions can be created
58WSDL Bindings
- binding is expressed with mixture of constructs
from WSDL 2.0 namespace and binding extension
namespace - we will study WSDL 2.0 constructs with SOAP1.2
binding extensions
59WSDL BindingsElement binding
lt?xml version"1.0" encoding"utf-8"
?gt ltdescription xmlns"http//www.w3.org/ns/wsdl"gt
ltdocumentationgt ... lt/documentationgt
lt!- type system --gt lttypesgt ... lt/typesgt
lt! WSDL 2.0 components --gt ltinterfacegt ...
lt/interfacegt ltbindinggt ... lt/bindinggt
ltservicegt ... lt/servicegt lt/descriptiongt
60WSDL BindingsElement binding
- attributes
- required name
- xsNCName
- unique within containing service description
- optional interface
- xsQName
- indicates interface for which binding information
is being specified - if present all interface operations and faults
must be binded inside
61WSDL BindingsElement binding
- attributes
- required type
- xsanyURI
- specifies kind of binding details inside
- http//www.w3.org/ns/wsdl/soap for SOAP1.2
binding - http//www.w3.org/ns/wsdl/http for HTTP binding
62WSDL BindingsElement binding
- attributes
- optional wsoapprotocol
- xmlnswsoap"http//www.w3.org/ns/wsdl/soap"
- specifies underlying network transfer protocol
for SOAP1.2 - http//www.w3.org/2003/05/soap/bindings/HTTP/ for
HTTP
63WSDL BindingsElement binding
- child elements
- optional documentation
- one or more (in any order)
- fault defines fault binding
- operation defines operation binding
64WSDL BindingsElement binding
DEMO
65WSDL BindingsElement binding/fault
- specifies binding of abstract fault to concrete
message format - e.g., for SOAP
- SOAP codes and subcodes representing abstract
fault in SOAP fault messages
66WSDL BindingsElement binding/fault
- attributes
- required ref
- xsQName
- references abstract fault for which binding
information is being specified - optional wsoapcode
- union of xsQName, xstoken
- maps abstract fault to specific SOAP fault with
given code - optional wsoapsubcodes
- union of (list of xsQName), xstoken
- specification of SOAP subcodes
67WSDL BindingsElement binding/fault
DEMO
68WSDL BindingsElement binding/operation
- specifies binding of abstract message to concrete
message format - e.g., for SOAP
- binding abstract WSDL MEP to SOAP MEP
69WSDL BindingsElement binding/operation
- attributes
- required ref
- xsQName
- references abstract message for which binding
information is being specified - optional wsoapmep
- union of xsanyURI, xstoken
- maps abstract fault to specific SOAP fault with
given code
70WSDL BindingsElement binding/operation
DEMO
71WSDL BindingsDefining SOAP Header Blocks
- WSDL SOAP binding extensions allow defining
required/optional header blocks in SOAP messages - element header contained in elements fault, input
and output
72WSDL BindingsElement header
- attributes
- required element
- xsQName
- element declaration within containing service
type system - required mustUnderstand
- xsboolean
- when true, SOAP header block must be complemented
with SOAP mustUnderstand attribute set to true
73WSDL BindingsElement header
- attributes
- required required
- xsboolean
- specifies whether this SOAP header block is
required or not
74WSDL BindingsElement header
DEMO
75WSDL Services
76WSDL BasicsConceptual Structure
Service Description
Abstract Description
Message
Operation
Interface
Concrete Description
Binding
Service
Endpoint
77WSDL Services
- WSDL description contains one or more services
- service specifies set of endpoints where
particular deployed implementation of bindinded
interface is provided - endpoints are alternate places at which service
is provided
78WSDL ServicesElement service
lt?xml version"1.0" encoding"utf-8"
?gt ltdescription xmlns"http//www.w3.org/ns/wsdl"gt
ltdocumentationgt ... lt/documentationgt
lt!- type system --gt lttypesgt ... lt/typesgt
lt! WSDL 2.0 components --gt ltinterfacegt ...
lt/interfacegt ltbindinggt ... lt/bindinggt
ltservicegt ... lt/servicegt lt/descriptiongt
79WSDL ServicesElement service
- attributes
- required name
- xsNCName
- unique within containing service description
- required interface
- xsQName
- indicates interface implemented by this service
80WSDL ServicesElement service
- child elements
- required endpoint
81WSDL ServicesElement service
DEMO
82WSDL ServicesElement endpoint
- defines details of particular service endpoint at
which service is available - endpoint service access point
- attributes
- required name
- xsNCName
- unique within containing service
83WSDL ServicesElement endpoint
- attributes
- required binding
- xsQName
- indicates binding of interface implemented by
service - optional address
- xsanyURI
- physical address where service can be accessed
84WSDL ServicesElement endpoint
DEMO
85WSDL 2.0 vs. WSDL 1.1