SOAP (protocol): Difference between revisions

From Citizendium
Jump to navigation Jump to search
imported>Thomas Ash
(New page: {{subpages}} '''SOAP''', originally defined as ''Simple Object Access Protocol'', is a protocol specification for exchanging structured information in the impleme...)
 
imported>Pat Palmer
m (Pat Palmer moved page SOAP to SOAP (protocol) without leaving a redirect)
 
(13 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{subpages}}
{{subpages}}


'''SOAP''', originally defined as ''Simple Object Access Protocol'', is a [[protocol (computing)|protocol]] specification for exchanging structured information in the implementation of [[Web Service]]s in [[computer network]]s. It relies on [[XML|Extensible Markup Language]] (XML) as its message format, and usually relies on other [[Application Layer]] protocols (most notably [[Remote Procedure Call]] (RPC) and [[HyperText Transfer Protocol|HTTP]]) for message negotiation and transmission. SOAP can form the foundation layer of a [[web services protocol stack]], providing a basic messaging framework upon which web services can be built.
'''SOAP''' is a [[client-server]] [[protocol (computing)|protocol]] on the [[World wide web|web]] for [[Remote Procedure Call|RPC]]-style messaging between a [[web service]] and its clients. The name SOAP was originally defined as ''Simple Object Access Protocol'', but this acronym fell out of favor as incorrectly representing the protocol.


As a layman's example of how SOAP procedures can be used, a SOAP message could be sent to a web service enabled web site (for example, a house price database) with the parameters needed for a search. The site would then return an XML-formatted document with the resulting data (prices, location, features, etc). Because the data is returned in a standardized machine-parseable format, it could then be integrated directly into a third-party site.
The protocol's request and response format is [[XML]], and the messages are usually carried on top of [[HyperText Transfer Protocol|HTTP]].  The SOAP specification grew out of an industry consortium soon after 2000; it relies on compilers to automatically read a web service contract (WSDL file) at compile time, and generate a [[proxy]] object. The local computer program communicates with the proxy object as if it were a local object, and the proxy object automatically handles all the RPC-style SOAP messaging between server and client.


==Sample SOAP message==
As of 2011, two versions of the SOAP protocol may be used: 1.1 or 1.2.  
===Request===
<source lang="xml">
<soapenv:Envelope
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/
                        http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Body>
    <req:echo xmlns:req="http://localhost:8080/axis2/services/MyService/">
      <req:category>classifieds</req:category>
    </req:echo>
  </soapenv:Body>
</soapenv:Envelope>
</source>


===Response===
== SOAP encoding ==
<source lang="xml">
 
<soapenv:Envelope
SOAP also refers to a dialect (encoding) of XML; SOAP-encoded XML is designed to be more concise that pure XML by providing pointer attributes for any duplicated data values.  However, SOAP-encoded XML was not popular for use in SOAP protocol messaging, and after early experiments, pure XML became widely preferred as the SOAP protocol message format.
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
 
    xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
== Sample SOAP v1.2 messages ==
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 
    xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/
The following is a sample SOAP 1.2 request and response, shown as the payload of an HTTP request and response message.
                        http://schemas.xmlsoap.org/soap/envelope/">
The request calls a web service method, ''GetQuote'', which requires no input parameters. The ''string'' in the SOAP response envelope is a placeholder and would be replaced, at run time, with an actual quote returned by the server:
   <soapenv:Header>
 
     <wsa:ReplyTo>
POST /quotes/Quote.asmx HTTP/1.1
      <wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>
Host: harbormist.com
    </wsa:ReplyTo>
Content-Type: application/soap+xml; charset=utf-8
    <wsa:From>
Content-Length: length
      <wsa:Address>http://localhost:8080/axis2/services/MyService</wsa:Address>
 
    </wsa:From>
<?xml version="1.0" encoding="utf-8"?>
    <wsa:MessageID>ECE5B3F187F29D28BC11433905662036</wsa:MessageID>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  </soapenv:Header>
   <soap12:Body>
   <soapenv:Body>
     <GetQuote xmlns="HarborMist" />
     <req:echo xmlns:req="http://localhost:8080/axis2/services/MyService/">
  </soap12:Body>
       <req:category>classifieds</req:category>
</soap12:Envelope>
     </req:echo>
 
   </soapenv:Body>
HTTP/1.1 200 OK
</soapenv:Envelope>
Content-Type: application/soap+xml; charset=utf-8
</source>
Content-Length: length
 
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
   <soap12:Body>
     <GetQuoteResponse xmlns="HarborMist">
       <GetQuoteResult>string</GetQuoteResult>
     </GetQuoteResponse>
   </soap12:Body>
</soap12:Envelope>

Latest revision as of 19:52, 24 October 2020

This article is developing and not approved.
Main Article
Discussion
Related Articles  [?]
Bibliography  [?]
External Links  [?]
Citable Version  [?]
 
This editable Main Article is under development and subject to a disclaimer.

SOAP is a client-server protocol on the web for RPC-style messaging between a web service and its clients. The name SOAP was originally defined as Simple Object Access Protocol, but this acronym fell out of favor as incorrectly representing the protocol.

The protocol's request and response format is XML, and the messages are usually carried on top of HTTP. The SOAP specification grew out of an industry consortium soon after 2000; it relies on compilers to automatically read a web service contract (WSDL file) at compile time, and generate a proxy object. The local computer program communicates with the proxy object as if it were a local object, and the proxy object automatically handles all the RPC-style SOAP messaging between server and client.

As of 2011, two versions of the SOAP protocol may be used: 1.1 or 1.2.

SOAP encoding

SOAP also refers to a dialect (encoding) of XML; SOAP-encoded XML is designed to be more concise that pure XML by providing pointer attributes for any duplicated data values. However, SOAP-encoded XML was not popular for use in SOAP protocol messaging, and after early experiments, pure XML became widely preferred as the SOAP protocol message format.

Sample SOAP v1.2 messages

The following is a sample SOAP 1.2 request and response, shown as the payload of an HTTP request and response message. The request calls a web service method, GetQuote, which requires no input parameters. The string in the SOAP response envelope is a placeholder and would be replaced, at run time, with an actual quote returned by the server:

POST /quotes/Quote.asmx HTTP/1.1
Host: harbormist.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
 <soap12:Body>
   <GetQuote xmlns="HarborMist" />
 </soap12:Body>
</soap12:Envelope>
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
 <soap12:Body>
   <GetQuoteResponse xmlns="HarborMist">
     <GetQuoteResult>string</GetQuoteResult>
   </GetQuoteResponse>
 </soap12:Body>
</soap12:Envelope>