WSDL (6)
-
Upload
pracha-asawateera -
Category
Documents
-
view
215 -
download
0
Transcript of WSDL (6)
-
8/13/2019 WSDL (6)
1/35
1
WSDL: Web Services DescriptionLanguage
#6#
-
8/13/2019 WSDL (6)
2/35
2
Outline What is WSDL?
WSDL Specifcation XML Schema Data Typing
-
8/13/2019 WSDL (6)
3/35
3
What is WSDL? WSDL is a specifcation defning how to describe web services in a
common XML grammar.
WSDL describes o!r critica" pieces o data $nterace inormation describing a"" p!b"ic"y avai"ab"e
!nctions
Data type inormation or a"" message re%!ests and message
responses
&inding inormation abo!t the transport protoco" to be !sed
'ddress inormation or "ocating the specifed service
-
8/13/2019 WSDL (6)
4/35
4
What is WSDL? WSDL represents a contract between the service re%!estor and the
service provider
&!t in m!ch the same way that a (ava interace represents a
contract between c"ient code and the act!a" (ava ob)ect.
The cr!cia" dierence is that WSDL is p"atorm* and "ang!age*
independent and is !sed primari"y +a"tho!gh not e,c"!sive"y- to
describe S'/ services.
-
8/13/2019 WSDL (6)
5/35
5
What is WSDL? 0sing WSDL1 a c"ient can "ocate a web service and invo2e any o its
p!b"ic"y avai"ab"e !nctions.
With WSDL*aware too"s1 yo! can a"so a!tomate this process1 enab"ing
app"ications to easi"y integrate new services with "itt"e or no man!a" code.
-
8/13/2019 WSDL (6)
6/35
6
WSDL Specification WSDL is an XML grammar or describing web services. The
specifcation itse" is divided into si, ma)or e"ements
defnitions
types
message
portType
binding
service
-
8/13/2019 WSDL (6)
7/35
7
WSDL Specification
-
8/13/2019 WSDL (6)
8/35
8
WSDL Specification Defnitions The defnitions e"ement m!st be the root e"ement
o a"" WSDL doc!ments.
$t defnes the namespace o the web service1 dec"ares m!"tip"e
namespaces !sed thro!gho!t the remainder o the doc!ment1
and contains a"" the service e"ements described here.
-
8/13/2019 WSDL (6)
9/35
9
WSDL Specification types The types e"ement describes a"" the data types !sed between
the c"ient and server.
WSDL is not tied e,c"!sive"y to a specifc typing system1 b!t it
!ses the W34 XML Schema specifcation as its dea!"t choice.
$ the service !ses on"y XML Schema b!i"t*in simp"e types1 s!ch as
strings and integers1 the types element is not required. ' !"" disc!ssion o the types e"ement and XML Schema is
deerred to the end o the chapter.
-
8/13/2019 WSDL (6)
10/35
10
WSDL Specification Message The message e"ement describes a one*way
message1 whether it is a sing"e message re%!est or a sing"e
message response.
$t defnes the name o the message and contains 5ero or
more message part e"ements1 which can reer to messageparameters or message ret!rn va"!es.
-
8/13/2019 WSDL (6)
11/35
11
WSDL Specification portType The portType e"ement combines m!"tip"e message
e"ements to orm a comp"ete oneway or ro!nd*trip operation.
or e,amp"e1 a portType can combine one re%!est and one
response message into a sing"e re%!est7response operation1 most co
mmon"y !sed in S'/ services.
8ote that a portType can +and re%!ent"y does- defne m!"tip"e
operations.
-
8/13/2019 WSDL (6)
12/35
12
WSDL Specification Binding The binding e"ement describes the concrete
specifcs o how the service wi"" be imp"emented on the wire.
WSDL inc"!des b!i"t*in e,tensions or defning S'/ service
s1 and S'/*specifc inormation thereore goes here.
-
8/13/2019 WSDL (6)
13/35
13
WSDL Specification Service The service e"ement defnes the address or
invo2ing the specifed service.
Most common"y1 this inc"!des a 09L or invo2ing the
S'/ service.
-
8/13/2019 WSDL (6)
14/35
14
WSDL Specification $n addition to the si, ma)or e"ements1 the WSDL specifcation a"so
defnes the o""owing !ti"ity e"ements
Documentation The doc!mentation e"ement is !sed to provide h!man*
readab"e doc!mentation and can be inc"!ded inside any other WSDL e"e
ment.
-
8/13/2019 WSDL (6)
15/35
15
WSDL Specification Import The import e"ement is !sed to import other WSDL
doc!ments or XML Schemas.
This enab"es more mod!"ar WSDL doc!ments.
or e,amp"e1 two WSDL doc!ments can import the same basic
e"ements and yet inc"!de their own service e"ements to ma2e the
same service avai"ab"e at two physica" addresses. 8ote1 however1 that not a"" WSDL too"s s!pport the import
!nctiona"ity as o yet.
-
8/13/2019 WSDL (6)
16/35
16
WSDL Example :,amp"e +word-
http://wsdl-example.doc/http://wsdl-example.doc/ -
8/13/2019 WSDL (6)
17/35
17
Definition
The defnitions e"ement specifes n!mero!s namespaces
that wi"" be !sed thro!gho!t the remainder o the doc!ment
-
8/13/2019 WSDL (6)
18/35
18
Definition
;wsd"defnitions
,m"nshttp
-
8/13/2019 WSDL (6)
19/35
19
Definition
The !se o namespaces is important or dierentiating e"ements1 and it
enab"es the doc!ment to reerence m!"tip"e e,terna" specifcations1 inc"!ding
WSDL specifcation S'/ specifcation
the XML Schema specifcation.
The defnitions e"ement a"so specifes a target8amespace attrib!te.
The target8amespace is a convention o XML Schema that enab"es the
WSDL doc!ment to reer to itse".
ina""y1 the defnitions e"ement specifes a dea!"t namespace
,m"nswsd"
-
8/13/2019 WSDL (6)
20/35
20
Message
There is message e"ements in WSDL.
)alsSoapIn )alsSoap+ut
)als,rraySoapIn
)als,rraySoap+ut
-
8/13/2019 WSDL (6)
21/35
21
Message;wsd"message name
;wsd"part name
;wsd"message name ;wsd"part name
;wsd"message name
;wsd"part name
;wsd"message name
;wsd"part name
-
8/13/2019 WSDL (6)
22/35
22
portType
;wsd"portType name
;wsd"operation name
;wsd"inp!t message
;wsd"o!tp!t message
;7wsd"operation>
;wsd"operation name
;wsd"inp!t message
;wsd"o!tp!t message
;7wsd"operation>
;7wsd"portType>
-
8/13/2019 WSDL (6)
23/35
23
portType
WSDL s!pports o!r basic patterns o operation
One-way
The service receives a message. The operation thereore has asing"e inp!t e"ement.
Request-response
The service receives a message and sends a response. The operation
thereore has one inp!t e"ement1 o""owed by one o!tp!t e"ement. Solicit-response
Notifcation
-
8/13/2019 WSDL (6)
24/35
24
portType
Solicit-response
The service sends a message and receives a response. The
operation thereore has one o!tp!t e"ement1 o""owed by one inp!t
e"ement.
Notifcation
The service sends a message. The operation thereore has a sing"e
o!tp!t e"ement.
-
8/13/2019 WSDL (6)
25/35
25
portType
-
8/13/2019 WSDL (6)
26/35
26
bining
The binding e"ement provides specifc detai"s on how a portType
operation wi"" act!a""y be transmitted over the wire.
&indings can be made avai"ab"e via m!"tip"e transports1 inc"!ding
@TT/ A:T1 @TT/ /ST1 or S'/.
$n act1 yo! can speciy m!"tip"e bindings or a sing"e portType.
-
8/13/2019 WSDL (6)
27/35
27
bining
;wsd"binding name
-
8/13/2019 WSDL (6)
28/35
28
service
The service e"ement specifes the "ocation o the service.
&eca!se this is a S'/ service1 we !se the soapaddress e"e
ment1 and speciy the "oca" host address
;soapaddress "ocation
-
8/13/2019 WSDL (6)
29/35
29
WSDL !nvocation Tools
yo! co!"d man!a""y create a S'/ c"ient to invo2e the
service. ' better a"ternative is to automatically invo2e the s
ervice via a WSDL invocation too".
-
8/13/2019 WSDL (6)
30/35
30
"ML Schema Data Typing
$n order or a S'/ c"ient to comm!nicate eective"y with a S'/
server1 the c"ient and server m!st agree on a data type system.
&y dea!"t1 XML B.C does not provide a data type system. $ncontrast1 every programming "ang!age provides some basic aci"ity
or dec"aring data types1 s!ch as integers1 oats1 do!b"es1 and strings.
WSDL does not aim to create a standard or XML data typing.
$n act1 WSDL is specifca""y designed or ma,im!m e,ibi"ity andis thereore not tied e,c"!sive"y to any one data type system.
-
8/13/2019 WSDL (6)
31/35
31
"ML Schema Data Typing
WSDL does dea!"t to the W34 XML Schema specifcation.
The XML Schema specifcation is a"so c!rrent"y the most wide"y !sed
specifcation or data typing.
There is two acts are cr!cia""y important.
irst1 the XML Schema specifcation inc"!des a basic type system
or encoding most data types.
Second1 the XML Schema specifcation provides a aci"ity orcreatingnew data types.
This is important i yo! want to create data types that go beyond
what is a"ready defned within the Schema.
-
8/13/2019 WSDL (6)
32/35
32
"ML Schema Data Typing
or e,amp"e1 a service might ret!rn an array o oats or a more comp"e, stoc2
%!ote ob)ect containing the high1 "ow1 and vo"!me fg!res or a specifc stoc2.
Whenever yo!r service goes beyond the simp"e XML Schema data types1 yo!
m!st dec"are these new data types within the WSDL types e"ement.
-
8/13/2019 WSDL (6)
33/35
33
#rrays
The WSDL f"e now inc"!des a types e"ement. $nside this e"ement1
we have defned two new comp"e, types.
the XML Schema defnes simp"e types and comp"e, types.
Simp"e types cannot have e"ement chi"dren or attrib!tes1
comp"e, types can have e"ement chi"dren and attrib!tes.
We have dec"ared comp"e, types in o!r WSDL f"e1 beca!se an
array may have m!"tip"e e"ements1 one or each va"!e in the array.
-
8/13/2019 WSDL (6)
34/35
34
$omplex Types
!r fna" topic is the !se o comp"e, data types. or e,amp"e1 consider a
home monitoring service that provides a concise !pdate on yo!r home.
The data ret!rned co!"d inc"!de m!"tip"e data e"ements1 s!ch as the c!rrenttemperat!re1
sec!rity stat!s1 and whether the garage door is open or c"osed.
:ncoding this data into WSDL re%!ires additiona"
2now"edge o XML Schemas1 which reinorces the main precept that the
more yo! 2now
abo!t XML Schemas1 the better yo! wi"" !nderstand comp"e, WSDL f"es.
-
8/13/2019 WSDL (6)
35/35
35
%uestion & #ns'er