You are on page 1of 79

SE3316b Web

Technologies
Introduction to Web Services
jagath@uwo.ca
TEB 351
519-661-2111 x80058
Fax: 519-850-2436

Dr. Jagath Samarabandu

Origin of Web Services


Web started out with the human interaction of
textual and graphical data
This is not quite suitable for machine-to-machine
interaction
Individuals and companies needed to publish
links to not only their information, but to their
applications as well
Internet based applications needed to find,
access and automatically interact with other
internet based applications
4-Nov-13

SE3316 Jagath Samarabandu

What is a Web Service


A Web service is an application
that accepts XML-formatted requests
from other systems across a network
via lightweight, vendor-neutral communications
protocols1.

These protocols have been defined by


standards organizations like OASIS and the
W3C.
This allows any network-enabled, XML-aware
application to invoke a Web service, regardless
of the programming language or operating
system involved.
1

Introduction to web services and the WS SDK V5.1, IBM developerWorks

4-Nov-13

SE3316 Jagath Samarabandu

Describing Web Services


Web Services architecture is
Distributed
Loosely coupled
Service oriented

Interface definition is crucial for a service oriented


architecture
Described using Web Services Description Language
(WSDL)
Defines the contract between client and server
What the service will provide
What the client can expect

4-Nov-13

SE3316 Jagath Samarabandu

Connecting Web Services


Loose coupling requires
Common format: message payload format
Common protocol: message transport

Most common combination is


Format: Simple Object Access Protocol (SOAP)
Protocol: Hypertext Transfer Protocol (HTTP)

Other combinations
Formats: REST and XML-RPC
Protocols: SMTP and IIOP

4-Nov-13

SE3316 Jagath Samarabandu

Web Service Technologies 1


Extensible Markup Language (XML)
Basic foundation
Provides a language for defining data and how to
process it
Family of related specifications by W3C

Web Services Description Language (WSDL)


XML based technology
Defines web services, interfaces, data and message
types, interaction patterns and protocol mappings

4-Nov-13

SE3316 Jagath Samarabandu

Web Service Technologies 2


Simple Object Access Protocol (SOAP)
A collection of XML based technologies
Defines an envelope for Web services communication
Mappable to HTTP and other transports
Provides a serialization format for transmitting XML documents
over a network
Provides conventions for representing RPC interactions

Universal Description, Discovery and Integration


A Web services registry and discovery mechanism
Used for storing and categorizing business information and
retrieving pointers to Web service interfaces

4-Nov-13

SE3316 Jagath Samarabandu

Distributed Computing: Reinventing


the Wheel
Shares many characteristics with DCOM, CORBA and
RMI, but
DCOM is proprietary
RMI is Java specific
CORBA is too complicated

Web is well established


Web connections are transient
Traditional distributed computing typically depends on
transport level connections and are not suitable for a
transient connection oriented medium like the Web
Allows develop now, integrate later approach (EAI)

4-Nov-13

SE3316 Jagath Samarabandu

The New Silver Bullet


Promises development of services
implemented in any language and
deployed on any hardware with any OS
Can it replace the Web, relational
databases, 4th generation languages and
AI?
In reality, it is just another layer that
provides an integration mechanism at a
higher level of abstraction
4-Nov-13

SE3316 Jagath Samarabandu

Inter-operability Heaven or Hell?


Web services contain WSDL, SOAP and UDDI
Is it WSDL v1.2, SOAP v1.1 and UDDI v1.0 ?
Or WSDL v1.1, SOAP v1.2 and UDDI v2.0 ?
What about XML, HTTP, TLS/SSL
Web Services Inter-operability Organization
(WS-I) was formed to address some of these
problems

4-Nov-13

SE3316 Jagath Samarabandu

10

WS-I Profiles and Testing


Web services profiles: aggregate collections of
key Web services standards, brought into
meaningful groupings, along with conventions
and best practice guidelines for their use
together, to simplify implementation and
promote interoperability
Web services testing and implementation
guidance: a set tools for self-administered tests
to determine conformance to baseline
specifications, aimed at improving interoperation
of infrastructure and applications [From WS-I
website]
4-Nov-13

SE3316 Jagath Samarabandu

11

WS-I Basic Profile 2.0


Finalized on Oct 11, 2010
Simple Object Access Protocol
(SOAP) 1.2 (Part 1 & 2)
SOAP Message Transmission
Optimization Mechanism (MTOM)
RFC2616: Hypertext Transfer
Protocol -- HTTP/1.1
RFC2965: HTTP State
Management Mechanism
Extensible Markup Language
(XML) 1.0 (Second Edition)
Namespaces in XML 1.0
XML Schema Part 1: Structures
XML Schema Part 2: Datatypes

4-Nov-13

Web Services Description


Language (WSDL) 1.1
UDDI Version 2.04 API
Specification, Dated 19 July 2002
UDDI Version 2.03 Data Structure
Reference, Dated 19 July 2002
UDDI Version 2 XML Schema
RFC2818: HTTP Over TLS
RFC2246: The TLS Protocol
Version 1.0
The SSL Protocol Version 3.0
RFC2459: Internet X.509 Public
Key Infrastructure Certificate and
CRL Profile

SE3316 Jagath Samarabandu

12

Web Services Architecture


Requester

bind

Provider

Directory
publish

find

Requester

4-Nov-13

bind

SE3316 Jagath Samarabandu

Provider

13

Web Service Scenarios


Componetized E-service (B2B)
Businesses can purchase access to online services offered by
other businesses
Service need not be customized for each client

Enterprise Application Integration (EAI)


Organizations can wrap their legacy applications in a
standardized format
Can migrate gradually to the new messaging architecture

Intra-enterprise component reuse


Provides the necessary framework to describe and discover the
existence, interface and location of software components
through WSDL and UDDI

4-Nov-13

SE3316 Jagath Samarabandu

14

XML in Web Services


All aspects of Web services are built on XML
How data is generically represented
How and with what qualities of service the data is
transmitted
How the services are published and discovered

Web service implementations decode these


various bits of XML to interact with various
applications and software domains underneath
the services

4-Nov-13

SE3316 Jagath Samarabandu

15

Web Service Technologies


WSDL (Web Service Description Language)
Language for describing network services
WSDL descriptions of capabilities and locations of services
Like an interface description language for Web services
Communication using SOAP or direct HTTP

SOAP (Simple Object Access Protocol)


Framework for exchanging information in a network
Not so simple now (specs at 500 pages and growing)

UDDI (Universal Description, Discovery, and Integration)


provides a registry mechanism for clients and servers to find
each other
uses SOAP for communication

4-Nov-13

SE3316 Jagath Samarabandu

16

WSDL Basics
Developed collaboratively by IBM,
Microsoft and Ariba. Now joined by a large
number of participants
Both parties to a web service interaction
need copies of the same WSDL file
WSDL is used to both describe web
services and locate web services
Typically WSDL files are generated by
web service-aware tools
4-Nov-13

SE3316 Jagath Samarabandu

17

What is WSDL?
WSDL describes a Web service in two
fundamental stages: one abstract and one
concrete.
At an abstract level, WSDL describes a Web
service in terms of the messages it sends and
receives; messages are described independent
of a specific wire format using a type system,
typically XML Schema.
Defined in WSDL 2.0 using operations,
interfaces, bindings and services.

4-Nov-13

SE3316 Jagath Samarabandu

18

WSDL Components
An operation associates a message exchange pattern
with one or more messages.
An interface (called porttype in 1.1) groups together
operations without any commitment to transport or wire
format.
At a concrete level, a binding specifies transport and
wire format details for one or more interfaces. An
endpoint associates a network address with a binding.
A service groups together endpoints that implement a
common interface.
- WSDL 2.0 Specification

4-Nov-13

SE3316 Jagath Samarabandu

19

WSDL Document Structure


A WSDL document defines a web services using
three categories of elements:
Content and data types of messages
Operations performed by messages
Specific protocol bindings for exchanging messages

These categories can be combined or re-used


once defined
Within these categories, there is a collection of
elements (or parts)

4-Nov-13

SE3316 Jagath Samarabandu

20

WSDL Layers
Service definition layer describes abstract
properties:
data types
message types
operations
services

Binding layer describes concrete properties:


protocols
data formats
(using SOAP, HTTP, MIME)

4-Nov-13

SE3316 Jagath Samarabandu

21

Seven Elements of WSDL (1.1)


Types
Data types in the form of XML schemas or other mechanisms

Message
An abstract definition of data in the form of a message presented
either as an entire document or as arguments to be mapped to a
method invocation

Operation
The abstract definition of the operation for a message, such as
naming a method, message queue or business process, that will
accept and process the message

4-Nov-13

SE3316 Jagath Samarabandu

22

7 WSDL Elements contd.


Port Type
An abstract set of operations mapped to one or more endpoints,
defining the collection of operations for a binding

Binding
The concrete protocol and data formats for the operations and
messages defined for a given port type

Port
A combination of a binding and a network address, providing the
target address of the service communication

Service
A collection of related endpoints encompassing the service
definitions that maps the bindings to the port

4-Nov-13

SE3316 Jagath Samarabandu

23

WSDL Concepts by Example


WSDL Terms
Port Type
Shopping Cart

Operation

Add
Remove
List

4-Nov-13

SE3316 Jagath Samarabandu

24

WSDL Concepts by Example


WSDL Terms
Shopping Cart Service
Shopping Cart
http://myservice.net/soap/cart

HTTP
SOAP

http://myservice.net/cart

HTTP
XML

Add
Remove

Port Type
Operation
Port

Binding

Service

List

4-Nov-13

SE3316 Jagath Samarabandu

25

WSDL Concepts by Example


WSDL Terms
Shopping Cart Service
AddItemInput

Shopping Cart
HTTP
SOAP

AddItemOutput
<soap:envelope
>
<soap:envelope
<soap:envelope>
>
<soap:body>
<soap:body>
<soap:body>
<soap:fault>
<soap:fault>
<soap:fault>
<faultcode>
<faultcode>
<faultcode>
<faultstring>

<faultstring>
<faultstring>

</soap:fault>
</soap:fault>
</soap:fault>
<soap:body>
<soap:body>
<soap:body>
<soap:envelope>
<soap:envelope>
<soap:envelope>
4-Nov-13

HTTP
XML

Add
Remove

Port Type
Operation
Port

Binding

Service

List

Message
Fault
Fault
Faults
SE3316 Jagath Samarabandu

26

Structure of a WSDL Document


<definitions>
<types> XML Schema element and type definitions
</types>
<message>One or more named parts typed by XML
Schema elements </message>
<portType> Describing a set of operations </portType>
<binding>Selects communication protocol and data
formats for each operation and message </binding>
<service>describes a collection of named ports, each
associated with a binding and a network address
</service>

</definitions>
4-Nov-13

SE3316 Jagath Samarabandu

27

WSDL: Describing Things


<definitions name=ShoppingCartDefinitions
xmlns=http://schemas/xmlsoap.org/wsdl targetNamespace= >
<types> </types>
<message name=AddItemInput> </message>
<message name=AddItemOutput> </message>
<portType name=ShoppingCart> </portType>
<binding name=CartHTTPXMLBinding type=tns:ShoppingCart>
<binding name=CartSOAPBinding type=tns:ShoppingCart>
<service name=ShoppingCartService>
<port name=HTTPXMLCart binding=tns:CartHTTPXMLBinding>
<port name=SOAPCart binding=tns:CartSOAPBinding>
</service>
<import namespace= location=>
</definitions>
4-Nov-13

SE3316 Jagath Samarabandu

28

WSDL: Describng Port Types


A named collection of related operations
<portType name=ShoppingCart>
<operation name=AddItem> </operation>
<operation name=RemoveItem> </operation>
<operation name=ListItems> </operation>
</portType>
Shopping Cart
Add
Remove
List
4-Nov-13

SE3316 Jagath Samarabandu

29

WSDL: Describing Operations


A signature (input, output and fault messages)
Operations can be one-way, request-response,
notifications or solicit-response
<operation name=AddItem>
<input message=tns:AddItemInput/>
<output message=tns:ACK/>
<fault name=BadCartID message=tns:BadCartID/>
<fault name=ServiceDown message=tns:ServiceDown/>
</operation>
Add
4-Nov-13

SE3316 Jagath Samarabandu

30

WSDL: Describing Messages


A named collection of message parts
Each part has a name and a type
<message name=AddItemInput>
<part name=cart-id type=xsd:string/>
<part name=item type=carttypes:item/>
<part name=image type=xsd:base64Binary/>
</message>

4-Nov-13

SE3316 Jagath Samarabandu

31

WSDL: Describing Data Types


Using the XML Schema language
<types>
<schema targetNamespace=http://myservice.net/cart/types
xmlns=http://www.w3.org/2000/10/XMLSchema>
<complexType name=item><all>
<element name=description type=xsd:string/>
<element name=quantity type=xsd:integer/>
<element name=price type=xsd:float/>
</all></complexType>
</schema>
</types>
4-Nov-13

SE3316 Jagath Samarabandu

32

WSDL: Describing Bindings


A named association of protocol details with a port type,
its operations and its messages
<binding name=CartHTTPXMLBinding
type=tns:ShoppingCart>
<http:binding verb=POST/>
<operation name=AddItem>
<http:operation location=/AddItem/>
<input> <mime:mimeXML/> </input>
<output> <mime:mimeXML/> </output>
<fault name=BadCartID> <mime:mimeXML/> </fault>
<fault name=ServiceDown> <mime:mimeXML/> </fault>
</operation>
</binding>
4-Nov-13

SE3316 Jagath Samarabandu

HTTP
XML
33

WSDL Example: Bindings


<binding name=CartHTTPSOAPBinding type=tns:ShoppingCart>
<soap:binding style=RPC transport=http://schemas.xmlsoap.org/soap/http/>
<operation name=AddItem>
<soap:operation soapAction=http://myservice.net/cart/AddItem/>
<input>
<soap:body use=encoded namespace=http://myservice.net/cart
encodingStyle=http://schemas.xmlsoap.org/soap/encoding/>
</input>
<output>
<soap:body use=encoded namespace=http://myservice.net/cart
encodingStyle=http://schemas.xmlsoap.org/soap/encoding/>
</output>
<fault name=BadCartID> <soap:body use=encoded namespace= />
</fault>
SOAP
<fault name=ServiceDown> <soap:body use= /> </fault></operation> XML
</binding>
4-Nov-13

SE3316 Jagath Samarabandu

34

WSDL: Describing Ports


A named association of a protocol binding
with a network address
<port name=SOAPCart binding=tns:SOAPCartBinding>
<soap:address location=http://myservice.net/soap/cart/>
</port>
HTTP
http://myservice.net/soap/cart SOAP
<port name=HTTPXMLCart
binding=tns:HTTPXMLCartBinding>
<http:address location=http://myservice.net/cart/>
</port>
HTTP
http://myservice.net/cart

4-Nov-13

SE3316 Jagath Samarabandu

XML

35

How WSDL Describes: Services


A related collection of ports
<service name=ShoppingCartService>
<documentation>A Shopping Cart for the Web</documentation>
<port name=HTTPXMLCart binding=tns:HTTPXMLCartBinding>
<http:address location=http://myservice.net/cart/>
</port>
<port name=SOAPCart binding=tns:SOAPCartBinding>
<soap:address location=http://myservice.net/soap/cart/>
</port>
</service>
4-Nov-13

SE3316 Jagath Samarabandu

36

WSDL: Describing Reuse


<import namespace=http://webservices.org/cart/cart-type
location=http://services.org/cart/cart-type.wsdl/>
<binding xmlns:ws=http://webservices.org/cart/cart-type
name=CartHTTPXMLBinding type=ws:ShoppingCart>

Shopping Cart
Shopping Cart Service

Add
Remove
AddItemInput

List
http://myservice.net/soap/cart

HTTP
SOAP

http://myservice.net/cart

HTTP
XML

http://xml.org/shopping/items.xsd
<soap:envelope >
Shopping
Add Cart
<soap:body>

Remove
List

<soap:fault>
<faultcode>
<faultstring>
</soap:fault>
<soap:body>
<soap:envelope>

AddItemOutput

http://webservices.org/cart/cart-type.wsdl

http://myservice.net/cart/cart.wsdl
4-Nov-13

SE3316 Jagath Samarabandu

37

Example of a WSDL Section


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

Example C function
getTerm(
char *getTermRequest,
char *getTermResponse
)

<portType name="glossaryTerms">
<operation name="getTerm">
<input message="getTermRequest"/>
<output message="getTermResponse"/>
</operation>
</portType>
4-Nov-13

SE3316 Jagath Samarabandu

38

WSDL Ports
Defines a web service, the operations that can
be performed, and the messages that are
involved.
The port defines the connection point to a web
service.
It can be compared to a function library (or a
module, or a class) in a traditional programming
language.
Each operation can be compared to a function in
a traditional programming language.
4-Nov-13

SE3316 Jagath Samarabandu

39

Operation Types
WSDL defines four operation types:
One-way: The operation can receive a message but
will not return a response
Request-response: The operation can receive a
request and will return a response
Solicit-response: The operation can send a request
and will wait for a response
Notification: The operation can send a message but
will not wait for a response

The request-response type is the most common


operation type
4-Nov-13

SE3316 Jagath Samarabandu

40

One-Way Operation Example


<message name="newTermValues">
<part name="term" type="xs:string"/>
<part name="value" type="xs:string"/>
</message>
<portType name="glossaryTerms">
<operation name="setTerm">
<input name="newTerm
message="newTermValues"/>
</operation>
</portType >

- Example from w3schools.com


4-Nov-13

SE3316 Jagath Samarabandu

41

Request-Response 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>
4-Nov-13

SE3316 Jagath Samarabandu

42

WSDL Binding Element


The binding element has two
attributes
name: name of the binding
type: port for binding

soap:binding element has two


attributes
style: "rpc" or "document"
transport: SOAP protocol

The operation element defines


each operation that the port
exposes.
For each operation the
corresponding SOAP action
has to be defined.

4-Nov-13

<binding type="glossaryTerms"
name="b1">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/
soap/http" />
<operation>
<soap:operation
soapAction="http://example.com/get
Term"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>

SE3316 Jagath Samarabandu

43

WSDL Port
Port
Port Type
Operation A
Message A (input)
Message B (output)
Operation B
Message C (output)

Binding 1

Binding 2

Binding 3

Network Addresses
4-Nov-13

SE3316 Jagath Samarabandu

44

WSDL Service
Service

Binding

Port

Port

Port

Port Type

Port Type

Port Type

Operation

Operation

Operation

Operation

Operation

Operation

Operation

Operation

Operation

Binding

Binding

Network Addresses

4-Nov-13

Binding

Binding

Binding

Network Addresses

SE3316 Jagath Samarabandu

Binding

Binding

Binding

Network Addresses

45

Other WDSL Bindings


HTTP
Selects GET or POST method
Absolute URI for each port
Relative URI for each operation
Optionally, encoding of request message parts (URL encoding,
URL replacement)

MIME
Specifies MIME types for message parts (text/xml,
multipart/related, ...)
Only describes data formats, needs SOAP/HTTP binding to
specify communication protocol

4-Nov-13

SE3316 Jagath Samarabandu

46

HTTP/MIME Binding Example


<binding name="binding type="tns:widgetPortType">
<http:binding verb="POST"/>
<operation name="getGadgetInfo">
<http:operation location="getGadgetInfo"/>
<input><mime:content type="application/x-www-form-urlencoded"/> </input>
<output><mime:mimeXml/> </output>
</operation>
<operation name="setGadgetInfo">
<http:operation location="setGadgetInfo"/>
<input>
<mime:multipartRelated>
<mime:part><mime:content part="id" type="text/plain"/> </mime:part>
<mime:part> <mime:mimeXml part="info"/> </mime:part>
</mime:multipartRelated>
</input>
<output><mime:content type="text/plain"/></output>
</operation>
</binding>
4-Nov-13

SE3316 Jagath Samarabandu

47

WSDL Related Namespaces


WSDL Framework
http://schemas.xmlsoap.org/wsdl

WSDL bindings for SOAP


http://schemas.xmlsoap.org/wsdl/soap

HTTP GET and POST bindings


http://schemas.xmlsoap.org/wsdl/http

MIME bindings
http://schemas.xmlsoap.org/wsdl/mime
4-Nov-13

SE3316 Jagath Samarabandu

48

WSDL Namespaces contd.


SOAP 1.1 encoding and envelope
http://schemas.xmlsoap.org/soap/encoding
http://schemas.xmlsoap.org/soap/envelope

XML schema namespace


http://www.w3.org/2001/XMLSchema

tns the namespace prefix used by


convention to refer to the current
document
4-Nov-13

SE3316 Jagath Samarabandu

49

WSDL Shortcomings
HTTP and MIME bindings are too loosely specified
Not all WSDL documents "make sense"
Which extension elements may/must be specified?
How are message parts ordered and identified in a response?
Can XML input be transmitted with urlReplacement?

WSDL is too closely tied with SOAP


Solicit-response and notification are not supported by
any existing binding
More complex interaction patterns cannot be described
(e.g. transactions)
WSDL is too closely tied with XML Schema

4-Nov-13

SE3316 Jagath Samarabandu

50

Web Service Technologies


WSDL (Web Service Description Language)
Language for describing network services
WSDL descriptions of capabilities and locations of services
Like an interface description language for Web services
Communication using SOAP or direct HTTP

SOAP (Simple Object Access Protocol)


Framework for exchanging information in a network
Not so simple now (specs at 500 pages and growing)

UDDI (Universal Description, Discovery, and Integration)


provides a registry mechanism for clients and servers to find
each other
uses SOAP for communication
4-Nov-13

SE3316 Jagath Samarabandu

51

Web Resources
SOAP Primer
http://www.w3.org/TR/soap12-part0/

Interactive web services with Java


http://www.brics.dk/~amoeller/WWW/webservices/ind
ex.html

SOAP Tutorial
http://www.w3schools.com/soap/default.asp

REST
http://tomayko.com/writings/rest-to-my-wife
4-Nov-13

SE3316 Jagath Samarabandu

52

What is SOAP?
SOAP is fundamentally a stateless, one-way message
exchange paradigm for XML-based information
Applications can create complex interactions by combining such
one way interactions

Typical message exchange styles:


Document-style (one-way XML messages)
RPC (Remote Procedure Call, request-response)

Typical protocol bindings:


HTTP/HTTPS (not the same as the HTTP binding for WSDL!)
SMTP (Simple Mail Transport Protocol)

Alternatives to SOAP: XML-RPC, REST

4-Nov-13

SE3316 Jagath Samarabandu

53

What SOAP is not


SOAP does not specify
The semantics of any application-specific data it conveys,
How SOAP messages are routed
How to achive reliable data transfer
How to traverse firewalls

SOAP provides the framework by which applicationspecific information may be conveyed in an extensible
manner.
SOAP also provides a full description of the required
actions taken by a SOAP node on receiving a SOAP
message.

4-Nov-13

SE3316 Jagath Samarabandu

54

What SOAP Needs


SOAP sends an XML message via HTTP request and
receives a reply (if any) via HTTP response
The HTTP listener must provide a SOAP processor
E.g. Apache Axis project

Thus, the HTTP listener must provide XML processing


capability
Be able to validate SOAP documents
Be able to understand SOAP documents

SOAP processors run on SOAP nodes


SOAP interactions are modeled as those between SOAP nodes
A SOAP node supports one or more SOAP processors
SOAP processor hands off the request to the application
4-Nov-13

SE3316 Jagath Samarabandu

55

Syntax Rules (SOAP 1.2)


A SOAP message MUST
Be encoded using XML
Use SOAP envelope namespace
Use SOAP encoding namespace

A SOAP message MUST NOT


Contain a DTD reference
Contain XML processing instructions

Namespaces refer to
http://www.w3.org/2003/05/soap-envelope
http://www.w3.org/2003/05/soap-encoding
http://www.w3.org/2003/05/soap-rpc
Choice of namespace prefixes is arbitrary and not significant
4-Nov-13

SE3316 Jagath Samarabandu

56

SOAP Message Structure


A SOAP message is an ordinary XML
document containing the following
elements:
A required Envelope element that identifies
the XML document as a SOAP message
An optional Header element that contains
header information
A required Body element that contains call
and response information
An optional Fault element that provides
information about errors that occurred while
processing the message

4-Nov-13

SE3316 Jagath Samarabandu

Envelope
Header

Body

Fault

57

SOAP Skeleten Message


<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
soap:encodingStyle="http://www.w3.org/2003/05/soapencoding">
<soap:Header>

... </soap:Header>

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

... </soap:Fault>

</soap:Envelope>
4-Nov-13

SE3316 Jagath Samarabandu

58

SOAP Envelope Element


The required SOAP Envelope element is the
root element of a SOAP message
It defines the XML document as a SOAP
message
It must use the proper envelope namespace
Encoding namespace defines complex
structures such as arrays and structs
Also references simple types from XML schema
Envelope element is a packaging mechanism
that indicates the start and end of a SOAP
message
4-Nov-13

SE3316 Jagath Samarabandu

59

SOAP Header Element


Optional
Intended to include additional features and
functionality
Security
Transactions
QoS Attributes

Loosely defined
For extensions to be meaningful, they must be
standardized
Application specific information can just as be sent in
the body

4-Nov-13

SE3316 Jagath Samarabandu

60

SOAP Body Element


Mandatory element that contains the actual SOAP message
SOAP Request

SOAP Response

<?xml version="1.0"?>
<soap:Envelope xmlns:soap=
soap:encodingStyle=">

<?xml version="1.0"?>
<soap:Envelope xmlns:soap=
soap:encodingStyle=">

<soap:Body>
<m:GetPrice xmlns:m=
"http://fruits.com/prices">
<m:Item>Apples</m:Item>
</m:GetPrice>
</soap:Body>
</soap:Envelope>

4-Nov-13

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

SE3316 Jagath Samarabandu

61

SOAP Fault Element


Optional fault element is used to hold error and
status information for a SOAP message
Must only appear once in the body element
Sub-elements
<faultcode> - A code for identifying the fault
<faultstring> - A human readable explanation of the
fault
<faultactor> - Who caused the fault to happen
<detail> - Application specific error information related
to the Body element
4-Nov-13

SE3316 Jagath Samarabandu

62

Fault Codes
VersionMismatch
Found an invalid namespace for the SOAP Envelope element

MustUnderstand
An immediate child element of the Header element, with the
mustUnderstand attribute set to "1", was not understood

Client
The message was incorrectly formed or contained incorrect
information

Server
There was a problem with the server so the message could not
proceed

4-Nov-13

SE3316 Jagath Samarabandu

63

Remote Procedure Calls


To invoke a SOAP RPC, the following information is needed
1.
The address of the target SOAP node.
2.
The procedure or method name.
3.
The identities and values of any arguments together with any
output parameters and return value.
4.
A clear separation of the arguments used to identify the Web
resource which is the actual target for the RPC, as contrasted with
those that convey data or control information used for processing
the call by the target resource.
5.
The message exchange pattern which will be employed to convey
the RPC, together with an identification of the so-called "Web
Method" to be used.
6.
Optionally, data which may be carried as a part of SOAP header
blocks.
4-Nov-13

SE3316 Jagath Samarabandu

64

SOAP RPC Request


<?xml version='1.0' ?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" >
<env:Header>
<t:transaction
xmlns:t="http://thirdparty.example.org/transaction"
env:encodingStyle="http://example.com/encoding"
env:mustUnderstand="true" > 5
</t:transaction>
</env:Header>
<env:Body>
<m:chargeReservation env:encodingStyle="http://www.w3.org/2003/05/soap-encoding"
xmlns:m="http://travelcompany.example.org/">
<m:reservation xmlns:m="http://travelcompany.example.org/reservation">
<m:code>FT35ZBQ</m:code>
</m:reservation>
<o:creditCard xmlns:o="http://mycompany.example.com/financial">
<n:name xmlns:n="http://mycompany.example.com/employees"> ke Jgvan yvind
</n:name>
<o:number>123456789099999</o:number>
<o:expiration>2005-02</o:expiration>
</o:creditCard> </m:chargeReservation> </env:Body> </env:Envelope>

SOAP HTTP Binding


SOAP Specification allows binding to any
type of transport mechanism
HTTP is the most widely used
Only one specified by the current version
A SOAP method is an HTTP
request/response that complies with the
SOAP encoding rules.
HTTP + XML = SOAP
4-Nov-13

SE3316 Jagath Samarabandu

66

SOAP HTTP Usage


A SOAP request could be
an HTTP POST or an
HTTP GET request.
The HTTP POST request
specifies at least two
HTTP headers: ContentType and Content-Length
Content-Type must be
application/soap+xml
Standard HTTP status
codes are used. E.g. 2xx
series for success and
4xx series for any fault
messages
4-Nov-13

HTTP POST Example


POST /Reservations HTTP/1.1
Host:
travelcompany.example.org
Content-Type:
application/soap+xml;
charset= "utf-8"
Content-Length: nnnn
<?xml version='1.0' ?>
<env:Envelope
xmlns:env="http://www.w3.
org/2003/05/soapenvelope" >
<env:Header>

</env:Envelope>

SE3316 Jagath Samarabandu

67

HTTP GET Example


HTTP GET Request
GET /travelco.example.org/reservations?code=FT35ZBQ
HTTP/1.1
Host: travelco.example.org
Accept: text/html;q=0.5, application/soap+xml

HTTP GET Response


HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset="utf-8"
Content-Length: nnnn
<?xml version='1.0' ?>
<env:Envelope
xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>

Web Service Technologies


WSDL (Web Service Description Language)
Language for describing network services
WSDL descriptions of capabilities and locations of services
Like an interface description language for Web services
Communication using SOAP or direct HTTP

SOAP (Simple Object Access Protocol)


Framework for exchanging information in a network
Not so simple now (specs at 500 pages and growing)

UDDI (Universal Description, Discovery, and Integration)


provides a registry mechanism for clients and servers to find
each other
uses SOAP for communication
4-Nov-13

SE3316 Jagath Samarabandu

69

Web Services Technologies


Points to description

UDDI
Registry

WSDL

Describes
Service

Finds
Service

Service
Consumer

SOAP

Web
Service

Communicates with
XML Messages
4-Nov-13

SE3316 Jagath Samarabandu

70

What is UDDI
"Universal Description, Discovery and
Integration (UDDI) is a specification for
distributed Web-based information registries
of Web services. UDDI is also a publicly
accessible set of implementations of the
specification that allow businesses to register
information about the Web services they offer
so that other businesses can find them."
UDDI Technical White Paper, Sept. 6, 2000, available from www.uddi.org.
[Composed by Ariba, IBM, Microsoft]
4-Nov-13

SE3316 Jagath Samarabandu

71

UDDI
Universal Description, Discovery and Integration
Developed by UDDI.org
Now a part of OASIS (Organization for the
Advancement of Structured Information separate
from W3C)

A registry for Web services


Helps you find a Web service and its description
(WSDL)
Search by business
Search by service type
4-Nov-13

SE3316 Jagath Samarabandu

72

What UDDI Is
UDDI is a technical discovery service.
Locates information about services exposed by a partner (and
locate potential partners).
Finds whether a partner's service is compatible with technologies
used by an inquiring business and discover technical parameters
so parameters in client applications can be set.
Provides links to the specifications of Web services so that an
inquiring business can build an integration layer to the service.

"Complements existing online marketplaces and search


engines by providing them with standardized formats for
programmatic business and service discovery."

4-Nov-13

SE3316 Jagath Samarabandu

73

What UDDI Is Not


UDDI is not a full discovery service that
would
Locate provider of a specific service in a
specific geographic area within a specific
timeframe.

This business negotiation service can be


built upon a UDDI foundation.

4-Nov-13

SE3316 Jagath Samarabandu

74

UDDI.org
Entity defining the UDDI specifications
Partnership among industry leaders
A project to encourage interoperability and
adoption of Web Services
Standards-based specifications for service
description and discovery

4-Nov-13

SE3316 Jagath Samarabandu

75

UDDI Working Group


Accenture
Ariba
Commerce One
Compaq
Fujitsu
Hewlett-Packard
i2

4-Nov-13

Intel
IBM
Microsoft
Oracle
SAP
Sun
Verisign

SE3316 Jagath Samarabandu

76

UDDI Versions
UDDI V1 Final June 2001
UDDI V2 Draft June 2001
Adds custom categorizations, business associations,
better query

UDDI V3.0.1 October 2003


Adds security, internationalization, better query,
subscriptions, notifications, and cross-registry
references

UDDI V3.0.2 February 2005


Adds URI as identifiers, digital signatures, combining
multi-step queries to a single complex query and
nesting sub queries within a single query
4-Nov-13

SE3316 Jagath Samarabandu

77

UDDI Shortcomings
Centered around programmatic access
No provision for service availability checks
No mechanism for community feedback
Neglects other aspects such as
negotiations on pricing, service level
agreements, terms and conditions
Is UDDI dead?
4-Nov-13

SE3316 Jagath Samarabandu

78

Resources
Uddi.org
www.ibm.com/services/uddi

4-Nov-13

SE3316 Jagath Samarabandu

79