Soap Protocol 1

Source: Internet
Author: User

SOAP is a simple XML-based protocol that allows applications to exchange information over HTTP.

Or, more simply, SOAP is the protocol used to access network services.

What is SOAP?
  • SOAP refers to Simple Object Access Protocol
  • SOAP is a communication protocol.
  • SOAP is used for communication between applications.
  • SOAP is a format used to send messages.
  • SOAP is designed for communication over the Internet
  • SOAP is independent from the platform
  • SOAP is independent of Language
  • SOAP Based on XML
  • SOAP is simple and scalable
  • SOAP allows you to bypass the Firewall
  • SOAP will be developed as W3C Standard

For application development, it is very important to enable Internet communication between applications.

Currently, applications use Remote Procedure Call (RPC) to communicate with objects such as DCOM and CORBA, but HTTP is not designed for this purpose. RPC may cause compatibility and Security Issues. firewalls and proxy servers usually block such traffic.

It is a better way to communicate between applications through HTTP, because HTTP is supported by all Internet browsers and servers. SOAP is created to complete this task. SOAP provides a standard method that allows applications running on different operating systems and using different technologies and programming languages to communicate with each other.

Microsoft and SOAP

SOAP is a key element of Microsoft. net architecture and is used for future Internet application development.

SOAP 1.1 is submitted to W3C

In March May 2000, UserLand, Arba, Commerce One, Compaq, Developmentor, HP, IBM, IONA, Lotus, Microsoft, and SAP submitted the SOAP Internet Protocol to W3C, these companies expect this Protocol to completely change application development by connecting graphic user interface desktop applications to powerful Internet servers using Internet standards (HTTP and XML.

W3C is developing SOAP 1.2.

The first draft of public work on SOAP was published by W3C in December 2001. For more information about SOAP activities in W3C, visit our W3C tutorial.

SOAP build Module

A soap message is a common XML document that contains the following elements:

  • The required Envelope element. This XML document can be identified as a SOAP message.
  • Optional Header elements, including Header information
  • Required Body elements, including all call and response information
  • An optional Fault element that provides information about errors that occur when processing the message.

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


And the default namespace for SOAP encoding and data types:


Syntax Rules

Here are some important syntax rules:

  • SOAP messages must be encoded in XML.
  • SOAP messages must use the SOAP Envelope namespace
  • SOAP messages must use the SOAP Encoding namespace
  • SOAP messages cannot contain DTD references
  • SOAP messages cannot contain XML processing instructions
Basic Structure of SOAP messages
<?xml version="1.0"?><soap:Envelopexmlns:soap=""soap:encodingStyle=""><soap:Header>  ...  ...</soap:Header><soap:Body>  ...  ...  <soap:Fault>    ...    ...  </soap:Fault></soap:Body></soap:Envelope>

The Envelope element of the forced SOAP is the root element of the SOAP message.

SOAP Envelope element

The required SOAP Envelope element is the root element of the SOAP message. It defines an XML document as a SOAP message.

Note xmlns: Use of the soap namespace. Its value should always be:

And it can define encapsulation as SOAP encapsulation:

<?xml version="1.0"?><soap:Envelopexmlns:soap=""soap:encodingStyle="">  ...  Message information goes here  ...</soap:Envelope>
Xmlns: soap namespace

SOAP messages must have an Envelope associated with the namespace ""

If different namespaces are used, an error occurs in the application and the message is discarded.

EncodingStyle attributes

The encodingStyle attribute of SOAP is used to define the data type used in the document. This attribute can appear in any SOAP
And will be applied to the content of the element and all child elements of the element. No default encoding method is available for SOAP messages.

<?xml version="1.0"?><soap:Envelopexmlns:soap=""soap:encodingStyle="">...Message information goes here...</soap:Envelope>

The optional SOAP Header element contains Header information.

SOAP Header element

Optional SOAP Header elements can contain application-specific information (such as authentication and payment) about SOAP messages ). If the Header element is provided, it must be the first child element of the Envelope element.

Note: The direct sub-elements of all Header elements must be qualified namespaces.

<?xml version="1.0"?><soap:Envelopexmlns:soap=""soap:encodingStyle=""><soap:Header><m:Transxmlns:m=""soap:mustUnderstand="1">234</m:Trans></soap:Header>......</soap:Envelope>

The preceding example contains a header with a "Trans" element. Its value is 234. The value of the "mustUnderstand" attribute of this element is "1 ".

SOAP in the default namespace (" ")
Three attributes are defined. These three attributes are: actor, mustUnderstand, and encodingStyle. The attributes defined in the SOAP header can define how the container
Process the SOAP message.

Actor attributes

By passing through different endpoints along the message path, SOAP messages can be transmitted from a sender to a receiver. Not all parts of the SOAP message are intended to be transmitted to the SOAP
The final endpoint of the message. However, in another aspect, it may be intended to be sent to one or more endpoints on the message path.

The actor attribute of SOAP can be used to address the Header element to a specific endpoint.

<?xml version="1.0"?><soap:Envelopexmlns:soap=""soap:encodingStyle=""><soap:Header><m:Transxmlns:m=""soap:actor="">234</m:Trans></soap:Header>......</soap:Envelope>
MustUnderstand attributes

The mustUnderstand attribute of SOAP can be used to identify whether a title item is mandatory or optional for the recipient to process it.

If you add a child element to the Header element
"MustUnderstand =" 1 "indicates that the recipient processing this header must recognize this element. If the recipient cannot recognize this element, it must be invalid when processing this header.

<?xml version="1.0"?><soap:Envelopexmlns:soap=""soap:encodingStyle=""><soap:Header><m:Transxmlns:m=""soap:mustUnderstand="1">234</m:Trans></soap:Header>......</soap:Envelope>
EncodingStyle attributes

The encodingStyle attribute of SOAP has been explained in the previous section.

The forced SOAP Body element contains the actual SOAP message.

SOAP Body Element

The required SOAP Body element can contain the actual SOAP message to be sent to the Message endpoint.

The direct sub-element of the SOAP Body element can be a qualified namespace. SOAP
In the default namespace (""), an element inside the Body element is defined. That is, the SOAP
Fault Element, used to indicate error messages.

<?xml version="1.0"?><soap:Envelopexmlns:soap=""soap:encodingStyle=""><soap:Body>   <m:GetPrice xmlns:m="">      <m:Item>Apples</m:Item>   </m:GetPrice></soap:Body></soap:Envelope>

The above example requests the price of apple. Note that the above m: GetPrice and Item elements are application-specific elements. They are not part of the SOAP standard.

A soap response should be similar to the following:

<?xml version="1.0"?><soap:Envelopexmlns:soap=""soap:encodingStyle=""><soap:Body>   <m:GetPriceResponse xmlns:m="">      <m:Price>1.90</m:Price>   </m:GetPriceResponse></soap:Body></soap:Envelope>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.