SOAP Getting St...login
SOAP Getting Started Tutorial
author:php.cn  update time:2022-04-11 14:22:12

SOAP syntax



SOAP Building Blocks

A SOAP message is an ordinary XML document containing the following elements:

  • Required Envelope Element, which can identify this XML document as a SOAP message

  • Optional Header element, containing header information

  • Required Body element , contains all call and response information

  • The optional Fault element provides information about the error that occurred while processing this message

All The above elements are declared in the default namespace for SOAP encapsulation:

http://www.w3.org/2001/12/soap-envelope

And the default namespace for SOAP encoding and data types:

http://www.w3.org/2001/12/soap-encoding


Grammar Rules

Here are some important syntax rules:

  • SOAP messages must be encoded in XML

  • SOAP messages The SOAP Envelope namespace must be used

  • The SOAP message must use the SOAP Encoding namespace

  • The SOAP message cannot contain a DTD reference

  • SOAP messages cannot contain XML processing instructions


Basic structure of SOAP messages

<?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:Header>
...
</soap:Header>

<soap:Body>
...
​ <soap:Fault>
​ ...
​ </soap:Fault>
</soap:Body>

</soap:Envelope>

php.cn