SOAP stands for Simple Object Access Protocol.
SOAP is a message protocol used between distributed elements of an application.
A protocol for exchanging information with web services.
It is an XML over HTTP protocol.
SOAP is extensible, transport-protocol neutral, and programming-model independent.
SOAP is integral to SOA (service-oriented architecture).
SOAP allows the sender to create a message route based on the logical services that have to be applied to the message on the way to its destination.
- secure and compliant connections
- controlling access
- reliable delivery
- failure recovery
- supports dynamic service discovery
- going through firewalls (for instance, RPC requires new ports be opened in the firewall, but SOAP uses HTTP which is probably already allowed through)
SOAP is designed to allow monolithic applications to be broken into smaller components without losing security and control.
SOAP is programming-language-independent and platform-independent.
SOAP and SOA are heavy-weight options intended for heavy-weight applications.
WSDL stands for Web Service Definition Language. It is an XML language.
WCF applications expose a public WSDL file which defines the operations available through the API and how to communicate with them.
Since SOAP uses XML messages, the messages are larger than CORBA (Common Object Request Broker Architecture) or RPC (Remote Procedure Call) which support binary messages.
A SOAP message is made up of:
- the envelope: defines the message structure
- headers: authentication credentials, definition of complex data-types
- body: the message or data
- faults: an optional element for error messages
Example of full message:
<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soap:Body> <NameOfWebService xmlns="https://tempuri.org/"> <ParameterName>12345</ParameterName> </NameOfWebService> </soap:Body> </soap:Envelope>
Example of defining a complex type:
<xsd:complexType> <xsd:sequence> <xsd:element name="Tutorial Name" type="string"/> <xsd:element name="Tutorial Description" type="string"/> </xsd:sequence> </xsd:complexType>
Example of response body:
<soap:Body> <GetTutorialInfo> <TutorialName>Web Services</TutorialName> <TutorialDescription>All about web services</TutorialDescription> </GetTutorialInfo> </soap:Body>
SOAP messages are almost always generated by a framework when you call a method on the web service.