SOAP 例子
SOAP 例子
在下面的示例中,GetQuotation请求将通过http发送到soap服务器。请求具有一个QuotationName参数,将在响应中返回一个报价。
函数的命名空间在http://www.xyz.org/quotation中定义。
下面是soap请求:
POST /Quotation HTTP/1.0 Host: www.xyz.org Content-Type: text/xml; charset=utf-8 Content-Length: nnn <?xml version="1.0"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2001/12/soap-envelope" SOAP-ENV:encodingStyle="http://www.w3.org/2001/12/soap-encoding" > <SOAP-ENV:Body xmlns:m="http://www.xyz.org/quotations" > <m:GetQuotation> <m:QuotationsName>MiscroSoft</m:QuotationsName> </m:GetQuotation> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
对应的soap响应如下:
HTTP/1.0 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: nnn <?xml version="1.0"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2001/12/soap-envelope" SOAP-ENV:encodingStyle="http://www.w3.org/2001/12/soap-encoding" > <SOAP-ENV:Body xmlns:m="http://www.xyz.org/quotation" > <m:GetQuotationResponse> <m:Quotation>Here is the quotation</m:Quotation> </m:GetQuotationResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>