Exploring the Future Potential of AI-Enabled Smartphone Processors
Web Services - WSDL
1. Web Services (NSWI145)
Lecture 04: Web Services Description Language
Martin Nečaský, Ph.D.
Faculty of Mathematics and Physics
Charles University in Prague, Czech Republic
Winter 2011
2. WSDL Foundations
Web Services Description Language
language for describing web service interfaces
in machine-readable notation
XML format
current version: 2.0
http://www.w3.org/TR/wsdl20
currently mostly supported version: 1.1
http://www.w3.org/TR/wsdl
3. WSDL Foundations
Interface
Port 1
Location: URL_1
Client
Transport: SOAP/HTTP
A
Implementation
Port 2
Location: URL_2
Client
Transport: SOAP/JMS
B
Port 3
Location: URL_3
Client
Transport: XML/HTTP
C
Winter 2011
4. WSDL Document
types
XML schema describing XML elements and attributes
messages
representation of data exchanged between clients and service
based on types
operations
service capabilities offered to clients
input and output messages
port types
collection of operations
bindings
specification of concrete protocol for exchanging messages between service
and clients which call operations from particular port type
ports
single endpoint combining particular binding and network address
services
collection of related ports
Winter 2011
5. WSDL Document
Service Description
Types
Abstract Messages
Description =
Operations
Port Types
Bindings
Concrete
= Ports
Description
Service
8. Types Definition
describes building blocks of XML messages
exchanged with service
any XML schema language with XML syntax
can be applied inside
XML Schema (XSD), Relax NG, Schematron, etc.
XSD preferred and used in practice
non-XML type system can be applied as well
? Do you know XSD ?
Winter 2011
10. Message Definition
zero or more message definitions
element message
defines single message type which can be
exchanged with the service
has unique name among all message types
• attribute name
<message name="[name]">
</message>
Winter 2011
11. Message Definition
message consists of one or more logical units called
message parts
element part
defines single message part
has unique name among all parts of the same message
• attribute name
is associated with element from the types definition ...
• attribute element
... or with simple or complex type from the types definition
• attribute type
<message name="[name]">
<!-- message part (1,*) -->
<part name="[part-name]" element="[element-ref]" type="[type-ref]" />
</message>
Winter 2011
13. Port Type Definition
zero or more port type definitions
port type encapsulates one or more
operations
element portType
defines single port type
has unique name among all port types types
• attribute name
<portType name="[name]">
</portType>
Winter 2011
14. Port Type Definition
element operation
defines single operation
has unique name among all operations in the port type
• attribute name
operation consumes input message and produces output
message, four supported message exchange patterns:
one-way (in)
request-response (in-out)
solicit-response (out-in)
notification (out)
<portType name="[name]">
<!-- operation (1,*) -->
<operation name="[operation-name]" />
</portType>
Winter 2011
15. Port Type Definition
element input (output, fault)
specifies input (output, fault) message type
has unique name among all inputs, outputs and faults within the
operation (attribute name )
reference to message type definition (attribute message)
one-way notification
<operation name="[operation-name]"> <operation name="[operation-name]">
<input name="[param-name]" <output name="[param-name]"
message="[message-ref]" /> message="[message-ref]" />
</operation> </operation>
request-response solicit-response
<operation name="[operation-name]"> <operation name="[operation-name]">
<input name="[param-name]" <output name="[param-name]"
message="[message-ref]" /> message="[message-ref]" />
<output name="[param-name]" <input name="[param-name]"
message="[message-ref]" /> message="[message-ref]" />
<fault name="[param-name]" <fault name="[param-name]"
message="[message-ref]" /> message="[message-ref]" />
</operation> </operation>
Winter 2011
17. Binding Definition
zero or more binding definitions
defines message format and protocol details for
operations and messages in particular port type
element binding
defines single binding
has unique name among all bindings
• attribute name
refers to particular port type
• attribute type
<binding name="[name]" type="[portType-ref]">
</binding>
Winter 2011
18. Binding Definition
specifies binding for each operation defined in port type
input and output messages, faults
element operation
binding of particular operation
• referred by attribute name
element input (output, fault)
binding of particular input (output, fault) message type
<binding name="[name]" type="[portType-ref]">
<!-- protocol specific binding information -->
<operation name="[operation-ref]">
<!-- protocol specific binding information -->
<input><!-- protocol specific binding information --></input>
<output><!-- protocol specific binding information --></output>
<fault><!-- protocol specific binding information --></fault>
</operation>
</binding>
Winter 2011
20. Service Definition
zero or more service definitions
i.e. one WSDL document can eventually define more
interfaces to one or more services
element service
defines single service interface + binding to particular
protocol and physical address
has unique name among all services
• attribute name
<service name="[name]">
</service>
Winter 2011
21. Service Definition
service consists of ports
element port
defines service port
has unique name among all ports of the service
• attribute name
refers to particular port type which defines port
operations and their input and output messages
• attribute binding
<service name="[name]">
<port name="[name]" binding="[binding-ref]">
<!-- protocol specific information -->
</port>
</service>
Winter 2011
22. Service Definition
Message of defined by
Message Types
Binding
input fault output input fault output
Operation of
Service Operation
Binding
comprises comprises comprises
has of
Port Binding PortType
Winter 2011
23. More on Bindings
HTTP
SOAP 1.1 over HTTP
SOAP 1.2 over HTTP
SOAP 1.1 over Java Messaging Service (JMS)
SOAP 1.2 over Java Messaging Service (JMS)
SOAP 1.1 over SMTP
...
Winter 2011
24. SOAP 1.2 Binding
namespace with SOAP 1.2 specific binding
extensions
http://schemas.xmlsoap.org/wsdl/soap12/
we will use prefix wsoap12
binding to SOAP 1.2 must start with element
wsoap12:binding
<binding name="[name]">
<wsoap12:binding />
</binding>
Winter 2011
25. SOAP 1.2 Binding
optional default operation style
specifies default style of each operation (RPC-oriented or document-
oriented operations)
attribute style
• values rpc or document, respectively
• document is default
mandatory transport protocol
URI of particular protocol
HTTP has http://schemas.xmlsoap.org/soap/http
attribute transport
<binding name="[name]">
<wsoap12:binding style="[style]" transport="[protocol-URI]"/>
</binding>
Winter 2011
26. SOAP 1.2 Binding
RPC-oriented operations
SOAP body contains only one part – element
whose name is the name of remote procedure to
be called
• contains element for each procedure parameter
document-oriented operations
SOAP body contains one or more child elements
called parts
part can be anything
Winter 2011
27. SOAP 1.2 Binding
each operation is further specified by wsoap:operation
element
may optionally have own style (rpc or document)
• attribute style
if the operation is not determined by its request message we can
determine it by SOAPAction HTTP header
• the value of the SOAPAction HTTP header for the operation can be specified in
attribute soapAction
• if you want SOAPAction HTTP header to be mandatory for this operation, use
attribute soapActionRequired
<binding name="[name]">
<operation name="[operation-ref]">
<wsoap12:operation style="[style]" soapAction="[action-URI]“
soapActionRequired="[boolean]" />
</operation>
</binding>
Winter 2011
28. SOAP 1.2 Binding
for each operation input/output we map one or more
message parts to SOAP body
element wsoap12:body
message parts specified by attribute parts
attribute use indicates whether parts specify schema for messages or
some other encoding of data to messages is used
• values literal or encoded, respectively
<binding name="[name]">
<operation name="[operation-ref]">
<input>
<wsoap12:body parts="[part-refs-list]" use="[use]" />
</input>
</operation>
</binding>
Winter 2011
29. SOAP 1.2 Binding
for each operation input/output we can map particular
message part to SOAP header
element wsoap12:header
mandatory attribute message
message part specified by attribute part
attribute use indicates whether part specifies schema for messages or
some other encoding of data to messages is used
• values literal or encoded, respectively
<binding name="[name]">
<operation name="[operation-ref]">
<input>
<wsoap12:header message="[message-ref]" part="[part-ref]"
use="[use]" />
</input>
</operation>
</binding>
Winter 2011
30. SOAP 1.2 Binding
for each operation input/output we can map
particular faults to SOAP fault
element wsoap12:fault
Winter 2011
31. SOAP 1.2 Binding
port is extended with physical location of
SOAP 1.2 endpoint
element wsoap12:address
• attribute location
<service name="[name]">
<port name="[operation-ref]">
<wsoap12:address location="[URI]" />
</port>
</binding>
Winter 2011