SOAP examples
Tue, Mar 27, 2001; by Jake Savin.
Request example
POST /examples HTTP/1.0
User-Agent: Radio UserLand/7.0 (MacOS)
Host: localhost:81
Content-Type: text/xml
Content-length: 474
SOAPAction: "/examples"
<?xml version="1.0"?>
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">
<SOAP-ENV:Body>
<m:getStateName xmlns:m="http://soapware.org/">
<param1 xsi:type="xsd:int">41</param1>
</m:getStateName>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Simple types
| Type value | Type | Example |
xsd:int or xsd:integer |
32-bit signed integer |
-12 |
xsd:boolean |
a boolean value, true or false |
true |
xsd:string |
string of characters |
hello world |
xsd:float or xsd:double |
signed floating point number |
-12.214 |
xsd:timeInstant |
date/time |
2001-03-27T00:00:01-08:00 |
xsd:base64 |
base64-encoded binary |
eW91IGNhbid0IHJlYWQgdGhpcyE= |
Struct example
<param>
<lowerBound xsi:type="xsd:int">18</lowerBound>
<upperBound xsi:type="xsd:int">139</upperBound>
</param>
Array example
<param SOAP-ENC:arrayType="xsd:ur-type[4]">
<item xsi:type="xsd:int">12</item>
<item xsi:type="xsd:string">Egypt</item>
<item xsi:type="xsd:boolean">false</item>
<item xsi:type="xsd:int">-31</item>
</param>
Response example
HTTP/1.1 200 OK
Connection: close
Content-Length: 499
Content-Type: text/xml
Date: Wed, 28 Mar 2001 05:05:04 GMT
Server: UserLand Frontier/7.0-MacOS
<?xml version="1.0"?>
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">
<SOAP-ENV:Body>
<getStateNameResponse>
<Result xsi:type="xsd:string">South Dakota</Result>
</getStateNameResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Fault example
HTTP/1.1 500 Server Error
Connection: close
Content-Length: 511
Content-Type: text/xml
Date: Wed, 28 Mar 2001 05:06:32 GMT
Server: UserLand Frontier/7.0-MacOS
<?xml version="1.0"?>
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring>
Can’t call “getStateName” because there are too many parameters.
</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
|