ตัวอย่าง SOAP
- หน้าก่อนหน้า SOAP HTTP Binding
- หน้าต่อไป สรุป SOAP
ตัวอย่าง SOAP
ในตัวอย่างด้านล่างนี้ คำขอ GetStockPrice ถูกส่งไปยังเซิร์ฟเวอร์ คำขอนี้มีตัวแปร StockName และในคำตอบจะมีตัวแปร Price ชื่อช่องที่ใช้นิยามนี้ถูกกำหนดในที่อยู่นี้: "http://www.example.org/stock"
SOAP คำขอ:
POST /InStock HTTP/1.1 Host: www.example.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.example.org/stock"> <m:GetStockPrice> <m:StockName>IBM</m:StockName> </m:GetStockPrice> </soap:Body> </soap:Envelope>
SOAP ตอบรับ:
HTTP/1.1 200 OK 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.example.org/stock"> <m:GetStockPriceResponse> <m:Price>34.5</m:Price> </m:GetStockPriceResponse> </soap:Body> </soap:Envelope>
- หน้าก่อนหน้า SOAP HTTP Binding
- หน้าต่อไป สรุป SOAP