次の例は、指定された利率、元金、月数を元に、月々のローンの支払いを計算する Web サービスオペレーションを呼び出したときに生成される SOAP リクエストとレスポンスを示しています。
この例は、元金、月数、および利率を元に、ローンの支払いを計算する Web サービスからの実際の SOAP リクエストです。SOAP エンベロープ本文 (SOAP-ENV:Body
) には、オペレーション名 (calculate) およびオペレーションパラメータ (principal、months、および rate) が含まれています。
<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/2001/XMLSchema" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"> <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/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <SOAP-ENV:Body> <calculate> <principal xsi:type="xsd:double">10000.0</principal> <months xsi:type="xsd:int">12</months> <rate xsi:type="xsd:float">0.08</rate> </calculate> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
SOAP エンベロープ本文の SOAP レスポンスには結果値が含まれています。
<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/2001/XMLSchema" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"> <SOAP-ENV:Body> <calculateResponse> <calculateResult xsi:type="xsd:double">1326.9497228077948</ calculateResult> </calculateResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>