Title: WSDL WSDL and UML
1WSDL WSDL and UML
www.eu-egee.org
EGEE is a project funded by the European Union
under contract IST-2003-508833
2UML to WSDL process
user
Client application
Servelet
Use case
interface
Class diagram
WSDL (interface Definition)
implementation
3Starting with UML
- Create a description of requirements in a use
case diagram - Create a description of interactions in a
sequence diagram - Create a description of the application (methods
and attributes/variables) in a class diagram
4Barnes Noble price client use case diagram
- This is an extremely simple use case
5bnclient class diagram
This is the simplest web service client
6Mapping UML - WSDL
- Attributes/variables become types
- Methods become operations
- Classes become portType
7bnquote WSDL
lt?xml version"1.0"?gt ltdefinitions
name"BNQuoteService" targetNamespace"BNQuoteServ
ice.wsdl" xmlnsxsd"http//www.w3.org/2001/XMLSch
ema" xmlnssoap"http//schemas.xmlsoap.org/wsdl/s
oap/" xmlns"http//schemas.xmlsoap.org/wsdl/"
xmlnstns"BNQuoteService.wsdl" gt ltmessage
name"getPriceRequest"gt ltpart name"isbn"
type"xsdstring"/gt lt/messagegt ltmessage
name"getPriceResponse"gt ltpart name"return"
type"xsdfloat"/gt lt/messagegt ltportType
name"BNQuotePortType"gt ltoperation
name"getPrice"gt ltinput message"tnsgetPriceRe
quest" name"getPrice"/gt ltoutput
message"tnsgetPriceResponse" name"getPriceRespo
nse"/gt lt/operationgt lt/portTypegt
8WSDL continued
ltbinding name"BNQuoteBinding" type"tnsBNQuotePo
rtType"gt ltsoapbinding style"rpc"
transport"http//schemas.xmlsoap.org/soap/http"/gt
ltoperation name"getPrice"gt ltsoapoperation
soapAction""/gt ltinput name"getPrice"gt ltso
apbody use"encoded" namespace"urnxmethods-BNPr
iceCheck" encodingStyle"http//schemas.xmlsoa
p.org/soap/encoding/"/gt lt/inputgt ltoutput
name"getPriceResponse"gt ltsoapbody
use"encoded" namespace"urnxmethods-BNPriceCheck
" encodingStyle"http//schemas.xmlsoap.org/so
ap/encoding/"/gt lt/outputgt lt/operationgt lt/bin
dinggt ltservice name"BNQuoteService"gt ltdocument
ationgtReturns price of a book at BN.com given an
ISBN numberlt/documentationgt ltport
name"BNQuotePort" binding"tnsBNQuoteBinding"gt
ltsoapaddress location"http//services.xmethods
.net80/soap/servlet/rpcrouter"/gt lt/portgt lt/ser
vicegt lt/definitionsgt
9Mapping WSDL to client
ltmessage name"getPriceResponse"gt ltpart
name"return" type"xsdfloat"/gt lt/messagegt
ltportType name"BNQuotePortType"gt ltoperation
name"getPrice"gt ltinput message"tnsgetPriceRequ
est" name"getPrice"/gt ltoutput
message"tnsgetPriceResponse" name"getPriceRes
ponse"/gt lt/operationgt lt/portTypegt
ltmessage name"getPriceRequest"gt ltpart
name"isbn type"xsdstring"/gt lt/messagegt
10Barnes Noble price example sequence diagram
- This simple example is a prototype for all web
services
11Web services and state
- Web services are generally described as
stateless. - In practice this means that you cannot guarantee
between interactions that you are interacting
with the same instance of the servlet. - While web services are, in themselves, inherently
stateless they can be made to behave in a
state-full manner - By using a database back end
- Using cookies
- etc
12Web services and state 2
- One of the reasons that you may be interacting
with different instances of a servlet lies in the
use of web services factories. - In order to deal with many connections it is
often useful to have a web services factory
create instances for each connection rather than
have a single listening service.
13Design considerations with Web Services
14Granularity
- At what level in the design do we introduce
services? - Too low and users are swamped in irrelevant
detail - Too high and they cant access the details they
need
15Example
Inappropriate
Appropriate
Aircraft
Travel agent
Aircraft
Airport flight slots
Airport flight slots
Maintenance cycle
Maintenance cycle
A consideration for both services and operations
16Traffic
Business
Yellow pages service
User
Address
17Traffic 2 Messaging systems
- Depends on the available (dedicated) bandwidth
- Dont want services where very frequent calls are
required (poss gt 1 per sec) - Dont want services to carry very large amounts
of data regularly - Process locally
- Pass encapsulated groups of data
18Serialisation
- Classes passed over web services are translated
to XML in transport - This means that the object at the server is not
necessarily identical to the object at the client.
19Summary
- Attributes/variables become types
- Methods become operations
- Classes become portType
- Appropriate granularity
- Awareness of network traffic
- Web services objects are serialised as XML