Web Service Implementation Option 2: Introduction to SOAP

 

Reference: https://en.wikipedia.org/wiki/SOAP

 

SOAP (formerly the acronym of Simple Object Access Protocol , that is, Simple Object Access Protocol ) is a protocol specification for exchanging data. It is used in computer network Web services (web services) to exchange structural information. In order to simplify the web server (Web Server) extracting data from the XML database, it saves the time to format the page, and implements data exchange between different applications in accordance with the HTTP communication protocol and XML format, making it abstract in language implementation, platform and hardware. This standard was jointly proposed by IBM , Microsoft , UserLand and DevelopMentor in 1998, and was supported by IBM, Lotus, Compaq and other companies, and was submitted to the World Wide Web Consortium ( W3C ) in 2000. , the current SOAP 1.1 version is the industry's common standard, belonging to the second generation of XML agreement (the first generation of the main representative technologies for XML-RPC and WDDX).

Use a simple example to illustrate the use of SOAP. A SOAP message can be sent to a Web site with Web Service functionality, for example, a database containing housing price information. The parameters of the message indicate that this is a query message, and the site will return An XML-formatted message that contains the query results (price, location, features, or other information). Because the data is delivered in a standardized, analyzable structure, it can be directly exploited by third-party sites.

 

 

Related Definitions

  • SOAP envelope (envelop), which defines a framework for describing what is in the message, who sent it, who should receive and process it, and how to process it;
  • SOAP encoding rules, which define a serialization mechanism for representing instances of data types that applications need to use;
  • SOAP RPC representation, which defines a contract for representing remote procedure calls and responses;
  • SOAP binding (binding), which defines which protocol SOAP uses to exchange information. You can use HTTP/TCP/UDP protocols.

Binding SOAP to HTTP provides the advantage of taking advantage of both the style and decentralized flexibility of SOAP and the rich feature library of HTTP. Delivering SOAP over HTTP is not to say that SOAP overwrites existing HTTP semantics, but that SOAP over HTTP semantics map naturally to HTTP semantics. Where HTTP is used as the protocol binding, RPC requests are mapped to HTTP requests, and RPC responses are mapped to HTTP responses. However, using SOAP over RPC is not limited to HTTP protocol bindings.

history

SOAP.svg
 

SOAP used to stand for "Simple Object Access Protocol", but this acronym has been dropped after version 1.2 of the standard. Version 1.2 became a W3C Recommendation on June 24, 2003 . This acronym is easily ambiguous with SOA - Service-oriented architecture, although there are very large differences between them.

SOAP was designed by Dave Winer, Don Box, Bob Atkinson, Mohsen Al-Ghosein in 1998 as an object access protocol. Today, the SOAP specification is maintained by the World Wide Web Consortium 's XML Working Group .

transfer method

SOAP uses the Internet Application Layer Protocol as its transport protocol. Both SMTP and HTTP protocols can be used to transmit SOAP messages, but HTTP is widely adopted because it works well in today's Internet structure, especially under network firewalls. SOAP can also be transported over HTTPS .

The message format of SOAP adopts XML .

grammar 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

SOAP message instance

ask

<soapenv:Envelope
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <req:echo xmlns:req="http://localhost:8080/wxyc/login.do">
      <req:category>classifieds</req:category>
    </req:echo>
  </soapenv:Body>
</soapenv:Envelope>

respond

<soapenv:Envelope
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
  <soapenv:Header>
    <wsa:ReplyTo>
      <wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>
    </wsa:ReplyTo>
    <wsa:From>
      <wsa:Address>http://localhost:8080/axis2/services/MyService</wsa:Address>
    </wsa:From>
    <wsa:MessageID>ECE5B3F187F29D28BC11433905662036</wsa:MessageID>
  </soapenv:Header>
  <soapenv:Body>
    <req:echo xmlns:req="http://localhost:8080/axis2/services/MyService/">
      <req:category>classifieds</req:category>
    </req:echo>
  </soapenv:Body>
</soapenv:Envelope>

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326852581&siteId=291194637