1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
|
************************************************************
*********** SOAP (Simple Object Access Protocol) ***********
************************************************************
SOAP is a minimal protocol for invoking methods on
servers/services/components/objects.
®áâ â®ç® ç áâ® šá¯®«ì§ã¥âáï ¢ á¢ï§ª¥ á WSDL, ª®â®à ï
®¯šáë¢ ¥â €®áâã¯ë¥ á¥à¢šáë
**********************
******** Soap Messages
**********************
£®«®¢®ª
---------
<SOAP:Envelope
xmlns:soap='http://www.w3.org/2001/12/soap-envelope'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:enc='http://www.w3.org/2001/12/soap-encoding'
SOAP:encodingStyle='http://www.w3.org/2001/12/soap-encoding'>
... Other code ...
</SOAP:Envelope>
encodingStyle - XSD Schema (®¯šáë¢ îé ï áâ € àâë¥ ¯à®£à ¬šá⪚¥
⚯ë â ªš¥, ª ª array, class š ¢á¥ â ª®¥)
á¬. Encoding
Headers
-------
<SOAP:Header>
... Some XML code here ...
</SOAP:Header>
The header section is used to encapsulate data that is not tied to a specific
method itself, but instead provides context knowledge, such as a transaction
ID and security information. For example:
<From>
cdix@soapworkshop.com
</From>
soap:mustUnderstand
--------------------
<SOAP:Header mustUnerstand="1">
...
</SOAP:Header>
If a SOAP server receives a message that includes a header element
with a mustUnderstand value of "1", and it is not expecting it, then
in order to comply with the SOAP protocol it should return a SOAP
Fault with a SOAP faultcode of "MustUnderstand".
soap:actor
----------
<SOAP:Header actor="URI">
Defines the URI for which the header elements are intended
Body
----
<SOAP:Body>
... Some XML code here ....
</SOAP:Body>
¡ï§ â¥«ì® €®«Š® ¯àšáãâá⢮¢ âì ¢ SOAP á®®¡é¥š¥, ®¡ëç® á®€¥àŠšâ ª®¬ €ã
á¥à¢¥àã š ¯ à ¬¥âàë, ¯àš¬¥à:
<DoCreditCheck>
<ssn>123-456-7890</ssn>
</DoCreditCheck>
Error Response
--------------
<SOAP:Fault>
<SOAP:Fault>
<faultcode>...</faultcode>
<faultstring>...</faultstring>
<faultactor>...</faultactor>
<detail>...</detail>
</SOAP:Fault>
</SOAP:Fault>
The SOAP protocol includes a way for the invoked method to return an error
message to the requestor.
faultcode: generic.refiner
generic - is a generic fault message
VersionMistmatch
MustUnderstand
Client
Server
refiner - more details
¯àš¬¥à: Client.authentication
faultstring: Human readable indication of error cause
faultactor: Indicates who, or what process, was attempting to run when
the fault occured
detail: If present, contains application-specific error information
®£ãâ ¡ëâì š €à㣚¥ â £š, ® ¯à¥€¯®çâšâ¥«ì® ¢áî €®¯®«šâ¥«ìãî šä®à¬ æšî
¢«®Ššâì ¢ ⥣ <detail>.
soap:href, soap:id
------------------
<SomeElement soap:href='#id1'/>
....
<OtherElement soap:id='#id1'> ... some content ... </OtherElement>
SOAP over HTTP
--------------
SOAP is RPC over HTTP protocol
Sample request:
POST <server page> HTTP /1.1
Content-Type: text/xml
SOAPAction: "my-name-space#my-method-name"
SOAP Message
Sample response:
MessageType: CallResponse
Content-Type: text/xml
SOAP Message
There will need to be some form of SOAP server that either acts upon, or acts
as routing agent for the SOAP messages. The is the URI end point of the POSTED
HTTP request.
*************
**** Encoding
*************
The aspects of SOAP described so far are sufficient to build very
sophisticated message based systems. A server specifies the XML it expects
in the body and/or header of a request message and the XML it will return in
the body and/or header of the response message. Clients are coded to provide
and consume the XML as specified by the server. Nothing more is needed.
However, one of the stated goals of SOAP is to act as an RPC transport
mechanism. In general, RPC requires that the input parameters to a method
called on the client be encoded, passed across the network, decoded, and the
method invoked on the server. Output parameters and the return value are
then encoded, passed across the network, decoded and returned to the client
application. When SOAP is used as the transport, both the client and server
must agree on how a parameter of a given type will be encoded in the
SOAP:Body element.
SOAP allows a client to indicate the encoding style used for a message using
the SOAP:encodingStyle attribute. The value of this attribute is an URI
which acts as the unique name of an encoding style. The server must
recognize URI and act to decode the data in accordance to that style. SOAP
defines a standard encoding style. Other styles can be defined and agreed
upon by client and server implementers, but the standard encoding style is
sufficient for most applications.
Note that using the SOAP encoding style does not require that the client or
server side actually be implemented using RPC. A client application could
directly generate messages that conform to the encoding style expected by
the server and/or the server can be coded to process the messages directly.
The standard SOAP encoding style defines how simple data types such as
strings, integers, dates, etc., and complex data types such as arrays and
structures, should be encoded. The basic rules are fairly simple: values are
encoded as the content of elements (as opposed to attributes) and the data
type of a given value must be specified either in the message itself or in a
schema associated with the message. In either case, data types are described
as specified in the XML Schema standard.
For example a request with all type information contained in the message
could be:
POST /ItemService HTTP/1.1
Host: hhhh
Content-Type: text/xml; charset="utf-8"
Content-Length: nnnn
SOAPAction:
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema/instance/"
SOAP-ENV:EncodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<is:getChildren xmlns:is="http://schemas.pge.com/ItemService">
<path xsi:type="xsd:string">a</path>
</is:getChildren>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
And the response which returns an array (the Items element) of structures
(the Item elements) could be:
HTTP/1.1 200 OK
Content-Type: text/xml; charset="uft-8"
Content-Length: nnnn
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema"
xmlns:xsi="http://www.w3.org/1999/XMLSchema/instance"
SOAP-ENV:EncodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<is:getChildrenResponse xmlns:is="http://schemas.pge.com/ItemService">
<items xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="is:Item[]">
<item>
<name xsi:type="xsd:string">e</name>
<value xsi:type="xsd:integer">1</value>
</item>
<item>
<name xsi:type="xsd:string">f</name>
<value xsi:type="xsd:integer">2</value>
</item>
<item>
<name xsi:type="xsd:string">g</name>
<value xsi:type="xsd:integer">3</value>
</item>
</items>
</is:getChildrenResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Another examples:
<Element xsi:type="enc:base64"> base64 encoded string </Element>
<Element enc:arrayType="xs:int[2]">
<number>3</number>
<number>4</number>
</Element>
<Element xmlns:enc="http://www.w3.org/2001/12/soap-encoding"
enc:arrayType="xs:string[6]"
enc:offset="[3]" >
<item>The fourth element</item>
<item>The fifth element</item>
</Element>
*****************
***** C Interface
*****************
|