Please visit our sponsors !
SOAP Elements
The <Envelope> element is the root element of a SOAP message.
<Header>, <Body>, and <Fault> are child elements.
SOAP Template
This is a template for a SOAP message:
<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>
|
The Envelope Element
The <Envelope> element is the root element of a SOAP message. It
defines the XML document as a SOAP message.
Note the use of the xmlns:soap namespace. This identifies the Envelope as a
SOAP Envelope:
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
...
Message information goes here
...
</soap:Envelope>
|
The Header Element
The optional <Header> element contains additional, application specific
information about the SOAP message:
<soap:Header>
<m:country xmlns:m="http://www.w3schools.com/country/">
<m:language>N</m:language>
<m:currency>NKR</m:currency>
</m:country>
</soap:Header>
|
The Header element in example above contains information about the language
and currency value used in the SOAP message.
Note that the <language> and <currency> elements above are
user-defined elements. They are not a part of the SOAP standard.
The Body Element
The mandatory <Body> element contains the actual SOAP message:
<soap:Body>
<m:GetPrice xmlns:m="http://www.w3schools.com/prices/">
<m:Item>Apples</m:Item>
</m:GetPrice>
</soap:Body>
|
Note that the <GetPrice> and <Item> elements above are
application specific elements. They are not a part of the SOAP standard.
The Fault Element
The <Body> element may contain a <Fault> element. The <Fault> element is used to provide information about errors that
occurred while processing the message. By nature this element can only appear in
answers (response messages):
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>Server Error</faultstring>
</soap:Fault>
</soap:Body>
|
You can read more about the fault element later in this tutorial.
Jump to: Top of Page
or HOME or
Printer friendly page
Search W3Schools:
What Others Say About Us
Does the world know about us? Check out these places:
Dogpile
Alta Vista
MSN
Google
Excite
Lycos
Yahoo
Ask Jeeves
We Help You For Free. You Can Help Us!
W3Schools is for training only. We do not warrant its correctness or its fitness for use.
The risk of using it remains entirely with the user. While using this site, you agree to have read and accepted our
terms of use and
privacy policy.
Copyright 1999-2002 by Refsnes Data. All Rights Reserved
|