Simple Object Access Protocol

Web Services Description Language

alfady@scs-net.org

alnashed@scs-net.org

***"#$
%& ' (
)
" !

........................................................................ INTRODUCTION
.. SIMPLE OBJECT ACCESS PROTOCOL
...................................................................................... Why SOAP SOAP
............................................................. SOAP Building Blocks SOAP
........................................................................................ Syntax Rules
........................ Optional SOAP Header Eelement

! SOAP

................................................................................... Actor Element Actor
....................................................... mustUnderstand Element mustUnderstand
........................................................... encodingStyle Element encodingStyle
.................................................... The SOAP Body Element SOAP

"

........................................................................... The HTTP Protocol HTTP
......................................... SOAP HTTP Binding HTTP

# SOAP

WEB SERVICES DESCRIPTION LANGUAGE WSDL $

%
&
'
.........................................................................................................

................................................................................. What is WSDL WSDL ' ()
.................................................................................. WSDL Document WSDL
............................................................ WSDL Document Structure WSDL
...................................................................................... WSDL Ports WSDL
.............................................................................. WSDL Messages WSDL
.................................................................................... WSDL Types WSDL
................................................................................. WSDL Binding WSDL
............................................................................................ WSDL Ports WSDL *
2

...................................................................................... WSDL Binding WSDL
....................................................................................... WSDL

3

WSDL

Introduction
!
,

-

"
&

#$ %

.

/0

&

' ()*

B2C Business to consumer % $12
31 4
$1

5! 1 6 12

9

1

:/%
*4

)

7

3 "

% $12

: "

=

1 4

1

$ 5

) % 6

* ) %
6 .

5!

8%&

;
+ /*

XML ?

%

1

C

W3C

#$

$ %/ 7

@"

3/

>*

&1

'

B Platform Independent

2 1/

4
$

@ >1/

A 4

)

<

Simple Object Access Protocol
1&

1
4

% %$ 3 )/

5
3 )

<

+ $ +( !

&

$

$
9

$

HTTP

4C %/

9 B42

! 9 BD

) >1/ ?

'

E Why SOAP SOAP 4
# ?
RPC
9 #

%

RPC + & =9

B6

) % 4

<& ?

4

F

%

HTTP

$

$

' 4 +/

%$ B DCOM , CORBA
)

% G 1$"

) %
<

3 7 B HTTP

$

J 9 ( ) , SOAP
>1/

&

<
$

%

9

%

: " *4 ! B
A

SOAP

I G
'

% K 9
1

& % I

A
HTTP

)

$

@

I &

'

2

B 1

@"

C

$

XML ? 1 %/ + / 9 SOAP

$

1

4

$% 4/

<

SOAP Building Blocks SOAP
$ XML ? 1 ? & D

% H

Envelope ? 1@

:
/ •

.1

1& D
),
) & :# #

:/

'

:

G

D

1& D

D

D

/ •

Body

1& % K D

D

Syntax Rules
XML 4

% $

/ •

;

/ •

$

/ !

" %

) SOAP

Enveloped 1@ % $ %

) SOAP

% $ %

) SOAP

'%

) SOAP

Encoded +(
XML ) &

1& D

Skeleton SOAP Message
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Header>
...
...
</soap:Header>
<soap:Body>
...
...
<soap:Fault>

5

...
...
</soap:Fault>
</soap:Body>
</soap:Envelope>
&) D

9 SOAP

$3 & 7

F

G

XML ? 1 (

&
D

9

6 11

? 1@

9 SOAP

M 4A $

XML L ? 1

SOAP

xmlns:soap <

/ %*

%/ 6

4

SOAP

xmlns:soap="http://www.w3.org/2001/12/soap-envelope+
) 3 7

NameSpace

SOAP ? 1@ 3 ; ? 1@

>@1 ;

<

?1

NameSpace

' SOAP

Optional SOAP Header

!% $

J2
4 83

$

/
Eelement

42 SOAP

%/ +

1& D

PAYMENT 5
NTransN

1 / %/

/ 9
1&

& >1/ Header
I

9

D

J9

G + 2"
3 D

/
%G
>1/G

# <
# %*

BN N

NmustUnderstandN

' nameSpace

7 A # SOAP ? &

Nhttp://www.w3.org/2001/12/soap-envelopeN
actor •
mustUnderstand •
encodingStyle •
' 1/ 4 ? $
1

6

Actor Element Actor
+& 3

!

<

+ /

>*

2

%

%*

soap

9

J9

2 %8 6

Syntax
soap:actor="URI"
Example
<soap:Header>
<m:Trans
xmlns:m="http://www.w3schools.com/transaction/"
soap:actor="http://www.w3schools.com/appml/">
234
</m:Trans>
</soap:Header>

mustUnderstand Element mustUnderstand
' 4 2) & %

>1/

)

*

J9 4
D

7

4D

)* 9

M> &

D

2

$ * •

D

)* 2

$ * •

Syntax
soap:mustUnderstand="0|1"
Example
soap:Header>
<m:Trans
xmlns:m="http://www.w3schools.com/transaction/"
soap:mustUnderstand="1">
234
</m:Trans>
</soap:Header>
encodingStyle Element encodingStyle
J9

?1

$

4

&

&
& 6

4
& H

encodingStyle
9 SOAP

/D 5

2C !
OI

Syntax
soap:encodingStyle="URI"
Example
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

8

3

...
Message information goes here
...
</soap:Envelope>
1& soap

D

9 Body soap 4 )

D

The SOAP Body Element SOAP

$

4)

/
/

<soap:Body>
<m:GetPrice xmlns:m="http://www.w3schools.com/prices">
<m:Item>Apples</m:Item>
</m:GetPrice>
</soap:Body>
B

soap
&

1

/% F

9 Getprice <

Item <

%/ 4# %

%/ BP

Prices

&

1 <

& G

'

1 $

) ' % $

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

9

#
P

$

The HTTP Protocol HTTP
%G 6

TCP/IP

&

$

##
4

5

<

&

' $

2 TCP/IP
Q TCP

$

$

HTTP

$

B

4

$" >1/ 4

%

&
&

$

HTTP

> * HTTP

1

$

9

ISO ?

%

% (

7

B TTP

POST /item HTTP/1.1
Host: 189.123.345.239
Content-Type: text/plain
Content-Length: 200
% ( > * HTTP

) '

1

= & 4

R /

200 OK
Content-Type: text/plain
Content-Length: 200
,
+&

1/ P )

9 a status code & 4

9 B

% $

J9

S & ?

1

42 4 *4

<

#

% 7

'

$" %
400 Bad Request
Content-Length: 0
SOAP HTTP Binding HTTP
1

2 HTTP

)
.

1/

1

$

5 SOAP

$

1 / %/ + / Soap 4& T 2

XML 5 <
HTTP + XML = SOAP

10

Soap %

%*
5I

!

%/

%

9 Soap

1 %

1/

9 HTTP

%

)

4 Content-Type <

%/ 7

HTTP POST request
HTTP GET request
Content-Type and Content-Length
Content-Length: bytes
Example
POST /item HTTP/1.1
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 250
4 Content-Length <

%/

soap 4 )

/
4/

The SOAP request
POST /InStock HTTP/1.1
Host: www.stock.org
Content-Type: application/soap+xml; charset=utf-8
Content-Length: nnn
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Body xmlns:m="http://www.stock.org/stock">
<m:GetStockPrice>
<m:StockName>IBM</m:StockName>
</m:GetStockPrice>
</soap:Body>
</soap:Envelope>

11

#

A SOAP response
HTTP/1.1 200 OK
Content-Type: application/soap; charset=utf-8
Content-Length: nnn
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Body xmlns:m="http://www.stock.org/stock">
<m:GetStockPriceResponse>
<m:Price>34.5</m:Price>
</m:GetStockPriceResponse>
</soap:Body>
</soap:Envelope>

12

?

Web Services Description Language WSDL
?

WSDL (Web Services Description Language
2

'

?

XML (

@

@ %*

>1/

@ %/ + /
2&

$G 4
@1 J 9 9 %/ 7
WSDL @1

$

WSDL port interface D WSDL @1

9U!

WSDL @

: ()G %/ 7

&

9


WSDL

2) 7

WSDL

D WSDL @1

2) %/ 7
WSDL

WSDL binding interface
: ) $ WSDL @1 1 $ /
- &
WSDL @ / ! •
W3C

< #

What is WSDL WSDL @
+ / WSDL (Web Services Description Language
&

2
XML @1

'
G V

?
>1/ &1

?

XML (

9

@ %*
>1/

@ %/

% $ % 6 1/ WSDL @

! 2&

Namespaces / I

Schema

29

(

?

+/ 2

4

XML L

$

& .

%/ + / 9
5!

A# 4

4

?
%;$

!%

W3C
&

?

S @

!7

Ariba, IBM and

W3C % I WSDL @1
$"

!%

#

9 WSDL @ %* *

94
J9

> G

%/ + / •

XML
&

$

7

XML @1
1/

<

>1/ ? &

W3C + $ $ @1 J 9 % WSDL 1.1

13

7

M
U

)

' $

XML

1 5 )1

21&) W3C

' W3C

$
K

"

K 4

<

K
2

&

&

?

Microsoft

$ %/ + / 9 W3C

& 7

Q Draft

WSDL 1.2

>1/

K

SW

$ " +/
!%

>

$ %

!% 9

2

$ !% $ % +
2/

"

(

I

&

$ 2I/

W3C

!%

WSDL Document WSDL
$

XML

$

9 WSDL
? &

%
?

6$
& %

$
/ ) >1/ D

WSDL Document Structure WSDL
& 4

WSDL
?

L

4

1& ?

& 4

? &
Element
&
<portType>

9
L

?

messages

& 4

<message>

!%
data types

L &

L

?

& 4

<types>

& 4

<binding>

!%
L

'

' $

?

!%

14

>1/ WSDL
<definitions>
<types>
definition of types........
</types>
<message>
definition of a message....
</message>
<portType>
definition of a port.......
</portType>
<binding>
definition of a binding....
</binding>
</definitions>
extension &

/ # X

/ I

% I & + &
/ !+

A %

D

& +/ 5 )
WSDL @1 1 $ /

% WSDL
/

%$

A # elements

>1/ HA , 6 $ B

WSDL
WSDL

WSDL Ports WSDL
94

B WSDL

2

%$

% I

&
B 9

49
%$
15

% ZportTypeY
1& B

&
?

&

&

)

@ % I +

?

$

# $ ZportTypeY

&

& % %$
1

WSDL Messages WSDL
!%
:() % ? ; %
1

)

?

messages
%$
@ % I

& ZmessageY

1&

&

5

/?

$

& 4

& 4

7

: () 3 " 6 $ B #$
WSDL Types WSDL

!%

&

data types

/ !F

WSDL @ 4

X

?

G

&

ZtypesY

& 4

@1 $ 5

) %

&

?

& XML Schema

WSDL Binding WSDL
!%

'

' $

$ ) % 6

?

&

4

ZbindingY
@

?

.2.2

& 4
& 4

$
#

WSDL
<part name="value" type="xs:string"/>
</message>
<portType name="glossaryTerms">
<operation name="getTerm">
<input message="getTermRequest"/>
<output message="getTermResponse"/>
</operation>
</portType>

16

% :() .I

#

1

? &

$

1 4 $ NglossaryTermsN ?
2

& portType

NgetTermN 1 & ?

& 4

& 4

@ 5
3

2
$

3 I

1/

NgetTermRequestN 4 '

&

% I 5 NgetTermN

#

$ B NgetTermN 4

/ ? & NgetTermResponseN 4 ' T
)

<

$ : () message
&

$ $ glossaryTerms

NgetTermRequestN 9 T

1

NgetTermRequestN 9
WSDL Ports WSDL

!% 2 /

4

1&

9 WSDL @

/ #$ 9 ZportTypeY
9( ) *%$

)

@

2)

+

?

1 )

1&
3 I

/ " #$G H

& %8
?

?

J)
)

)

? L

$B
&

94

* L 1 &1 %$

[ 1

)

$

1

[ 1 H

&

' WSDL @ ? &
H
One-way
Request-response
Solicit-response

\: )
4# %

* 1 &1 %$
) '

$

& ?
)

C ' 4

7

& % %$

1 &1 %$

) '

&

1 / $ 3 " %$

request-response

&

1 &1 %$
)

L

$

? &

& G

L

4

WSDL

$ 32 " 6 $

@ % I 5

6 5 %$

?

C ' 4

1
&"*
%

17

Notification

J) H

One-Way
J)

%

1 / >1/

1/
#

1

<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 >

NsetTermN >/

J)

NnewTermValuesN
1& J2 T

D ?

1/ ?

&

4

F

& 4 '

NglossaryTermsN
1+ )

4

1
NtermN 9

NvalueN

;D
)

1& % H
\

1 H

%

1& J9 1
T

& ?

1/ ?

&

.1

1

NglossaryTermsN
2
NvalueN >/

18

] 1
9 %/

4

) 8 1& J9 4

NtermN

#

8 1& J9 .

Request-Response
)

<

#

1/
#
9

1
7 )

B NgetTermN 9

NgetTermRequestN >/
5 NgetTermResponseN

<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>

WSDL Binding WSDL
!%

'

' $
$ ) % 6

?

&

ZBindingY

4

@
)

\

<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"/>
19

1

& 4
?

& 4

1/ D

D

$

$

$
#

;

</operation>
</portType>
<binding type="glossaryTerms" name="b1">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<operation>
<soap:operation
soapAction="http://example.com/getTerm"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
? & type H
J

B name 4 '
D

4' 4

6$

6 1 NglossaryTermsN

& 4

$

1

%
G

" type H
&

soap:binding
% $ % %$
4

SOAP 5 4
20

& 61

name 4 '

style 4

Bdocument +

HTTP
HTTP 9 4

1&
I

NrpcN $" %

binding
1/ 4

&

NdocumentN $" %
& 4

&

B style 4

transport
?

9%

1
$

SOAP 7

?

& 4

1/ $ ) %

NliteralN

T

2I &
(

1/ $ ?
$ I

!

3

4

$ WSDL Syntax

Q

%

)

1$ /

W3C %/ +

1
Draft

<wsdl:definitions name="nmtoken"? targetNamespace="uri">
<import namespace="uri" location="uri"/> *
<wsdl:documentation .... /> ?
<wsdl:types> ?
<wsdl:documentation .... /> ?
<xsd:schema .... /> *
</wsdl:types>
<wsdl:message name="ncname"> *
<wsdl:documentation .... /> ?
<part name="ncname" element="qname"? type="qname"?/> *
</wsdl:message>
<wsdl:portType name="ncname"> *
<wsdl:documentation .... /> ?
<wsdl:operation name="ncname"> *
<wsdl:documentation .... /> ?
<wsdl:input message="qname"> ?

21

<

WSDL / !

WSDL
@

& operation

<wsdl:documentation .... /> ?
</wsdl:input>
<wsdl:output message="qname"> ?
<wsdl:documentation .... /> ?
</wsdl:output>
<wsdl:fault name="ncname" message="qname"> *
<wsdl:documentation .... /> ?
</wsdl:fault>
</wsdl:operation>
</wsdl:portType>
<wsdl:serviceType name="ncname"> *
<wsdl:portType name="qname"/> +
</wsdl:serviceType>
<wsdl:binding name="ncname" type="qname"> *
<wsdl:documentation .... /> ?
<-- binding details --> *
<wsdl:operation name="ncname"> *
<wsdl:documentation .... /> ?
<-- binding details --> *
<wsdl:input> ?
<wsdl:documentation .... /> ?

22

<-- binding details -->
</wsdl:input>
<wsdl:output> ?
<wsdl:documentation .... /> ?
<-- binding details --> *
</wsdl:output>
<wsdl:fault name="ncname"> *
<wsdl:documentation .... /> ?
<-- binding details --> *
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ncname" serviceType="qname"> *
<wsdl:documentation .... /> ?
<wsdl:port name="ncname" binding="qname"> *
<wsdl:documentation .... /> ?
<-- address details -->
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

23

Sign up to vote on this title
UsefulNot useful