I. Soap
Soap was initially used as the RPC mechanism. Later, XML was widely used. It is also an application-level protocol like HTTP. It can be used in different applications.ProgramData exchange between applications. Soap can be based on HTTP or other transmission protocols other than http to achieve communication between applications.
The SOAP protocol is an envelope consisting of a message header (optional) and a message body (mandatory.
1. Message Header: Specifies the endpoint type attribute targeted by the message header, which is rarely used; whether the message header must be processed
The header information is often stored and the message semantics is not directly related information
2. Message Body: Each webmethod call has a corresponding SOAP message.
For example, the request soap corresponding to the previous Login
<? 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" >
9 < Soap12: Header >
10 < Myserviceclassheader Xmlns = "Http://tempuri.org /" >
11 < USN > STring </ USN >
12 < Paw > String </ Paw >
13 </ Myserviceclassheader >
14 </ Soap12: Header >
15 < Soap12: Body >
16 < Login Xmlns = "Http://tempuri.org /" />
17 </ Soap12: Body >
18 </ Soap12: Envelope >
the program defines a class inherited from soapheader. myserviceclassheader,
it contains two attributes: USN and Paw. used to carry the username and password respectively.
the corresponding soap contains a sub-element myserviceclassheader
the message body mainly contains the call information for the web method, such as login xmlns =" http://tempuri.org/" />
login is the called method. If this method has parameters, it also has sub-elements used to describe the parameters and parameter values of the called function.
This is a response to the SOAP message.
<? XML version = "1.0" encoding = "UTF-8" ?>
26 < 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" >
27 < Soap12: Body >
28 < Loginresponse Xmlns = "Http://tempuri.org /" >
29 < Loginresult > String </ Loginresult >
30 </ Loginresponse >
31 </ Soap12: Body >
32 </ Soap12: Envelope >
The element name corresponds to the Request Method Name + response. If there is a return value, there is also a sub-element method name + result.
2 WSDL
is a syntax specification used to describe Web Services. for each web service, it is a description document.
describes the Web service location, protocol, and interface in detail. provided by Web Service developers.
the WSDL file consists of five parts: types, message, porttype, binding, and service.
1 Types definition: Type Definition, independent of language. definitions corresponding to the element information to be transmitted in soap messages
2 message: Each web method corresponds to two message definitions in and out. the message definition includes the header and body
3 porttype: each Web Service corresponds to a porttype, and this porttype also contains the release method for it, operation.
4 bindings: Specify the binding information of each operation (class and method) in each porttype, including the format of the input and output messages.
5 Service: port information bound to each Web Service