Soap and WSDL

Source: Internet
Author: User

I. Soap

Soap was initially used as the RPC mechanism. Later, XML was widely used. like HTTP, HTTP is an application-level protocol that enables data exchange between different applications. soap can be based on HTTP or other transmission protocols other than http to implement 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>
In the program, we define a class inherited from soapheader, myserviceclassheader,
The USN and Paw attributes are used to carry the user name and password respectively.
The corresponding soap contains a sub-element, myserviceclassheader.
The message body mainly contains the call information to 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.

Ii. WSDL
It is a syntax specification used to describe Web services. For each web service, it is a description document.
Detailed descriptions of web service locations, protocols, and interfaces are provided by Web Service developers.
The WSDL file consists of five parts: types, message, porttype, binding, and service.
1 Types definition: type definition, which is independent of the language and corresponds to the definition of 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. This porttype contains the release method 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

Original article: http://www.cnblogs.com/engine1984/articles/1105170.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.