分类: 系统运维
2010-06-04 15:41:22
SOAP is a simple XML-based protocol to let applications exchange information over HTTP.
HTTP + XML = SOAP
Or more simply: SOAP is a protocol for accessing a Web Service.
What is SOAP?
•SOAP stands for Simple Object Access Protocol
•SOAP is a communication protocol
•SOAP is for communication between applications
•SOAP is a format for sending messages
•SOAP communicates via Internet
•SOAP is platform independent
•SOAP is language independent
•SOAP is based on XML
•SOAP is simple and extensible
•SOAP allows you to get around firewalls
•SOAP is a W3C recommendation
Why SOAP?
It is important for application development to allow Internet communication between programs.
Today's applications communicate using Remote Procedure Calls (RPC) between objects like DCOM and CORBA, but HTTP was not designed for this. RPC represents a compatibility and security problem; firewalls and proxy servers will normally block this kind of traffic.
A better way to communicate between applications is over HTTP, because HTTP is supported by all Internet browsers and servers. SOAP was created to accomplish this.
SOAP provides a way to communicate between applications running on different operating systems, with different technologies and programming languages.
SOAP Syntax
A SOAP message is an ordinary XML document containing the following elements:
•An Envelope element that identifies the XML document as a SOAP message
•A Header element that contains header information
•A Body element that contains call and response information
•A Fault element containing errors and status information
===========================================================
xmlns:soap=""
------The namespace defines the Envelope as a SOAP Envelope
soap:encodingStyle="">
------ encodingStyle is used to define data types used in the document
------header contains application-specific information (eg: authentication, payment, etc)
------if the header element is present, it must be the first child element of the Envelope element
...
------contains the actual SOAP message intended for the ultimate endpoint of the message.
...
...
------SOAP defines 3 default attributes in the default namespace: mustUnderstand, actor, encodingStyle
============================================================
relation ship between HTTP and SOAP
webservice 的调用有3种方式
1. httpget
2. httppost
3. httpsoap
soap 的优点是 可以传递结构化的 数据,而前两种不行。
btw, soap 最终也是使用 HTTP 传送 XML
src: