Soap examples

SOAP request example

The SOAP request that follows indicates that the OrderItem() method, from the Some-URI namespace, should be invoked from http://www.somesupplier.com/Supplier. Upon receiving this request, the supplier application at www.somesupplier.com runs the business logic that corresponds to OrderItem.

Note: For legal information about this code example, see the Code example disclaimer.

Sample SOAP Request 
POST /Supplier HTTP/1.1
Host: www.somesupplier.com
Content-Type: text/xml; charset="utf-8"
Content-Length: nnnn
SOAPAction: "Some-URI"  

<SOAP-ENV:Envelope
   xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
   SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> 
   <SOAP-ENV:Body>
      <m:OrderItem xmlns:m="Some-URI">
      <RetailerID>557010</RetailerID>
      <ItemNumber>1050420459</ItemNumber>
      <ItemName>AMF Night Hawk Pearl M2</ItemName>
      <ItemDesc>Bowling Ball</ItemDesc>
      <OrderQuantity>100</OrderQuantity>
      <WholesalePrice>130.95</WholeSalePrice>
      <OrderDateTime>2000-06-19 10:09:56</OrderDateTime>
      </m:OrderItem>
   </SOAP-ENV:Body>  
</SOAP-ENV:Envelope>

The SOAP protocol does not specify how to process the order. The supplier could run a CGI script, invoke a servlet, or perform any other process that generates the response.

SOAP response example

The response to a SOAP Request is an XML document that contains the results of the processing. In this example, this is the order number for the order placed by the retailer.

Note: For legal information about this code example, see the Code example disclaimer.

HTTP/1.1 200 OK
Content-Type: text/xml; charset="utf-8"
Content-Length: nnnn  

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
   <SOAP-ENV:Body>
      <m:OrderItemResponse xmlns:m="Some-URI">
      <OrderNumber>561381</OrderNumber>
      </m:OrderItemResponse>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

The response does not include a SOAP-specified header. The results are placed in an element whose name matches the method name (OrderItem) with the suffix (Response), such as OrderItemResponse.