This document is an entry-level document that generated with Ctrl C -> Ctrl V, mainly to explain what is the architecture of WebServices, WebServices, and several related XML documents. Due to the very limited knowledge of the younger brother, please ask the brothers in the text, the younger brother is thankful.
What is WebServices?
From the surface: WebServices is an application that exposes an API that can be called by the web. That is to say, you can call this application with a programming method. We call the app called this Webservices.
More professional descriptions are as follows: WebServices is an interface describing some operations (using standardized XML message delivery mechanisms can access these operations via network). WebServices is a service description called WebServices using standard, specified XML concepts, called WebServices. This description contains all details required by the service interaction, including message format (detailed description operation), transport protocols, and locations. The interface hides the details of the service, allowing the programming language that is independent of the service-based hardware or software platform and the programming language used. This allows and supports WebServices-based applications to become loose coupling, facing components and cross-technical implementation. WebServices fulfills a specific task or a set of tasks. WebServices can be used separately or with other WebServices to achieve complex aggregation or business transactions, as well as enterprise integration (EAI).
WebServices model
The WebServices Architecture is based on the interaction between three roles (service providers, service registration centers, and service requesters). Interaction involves publishing, looking for and binding operations. These roles and operations work together to the WebServices component:
WebServices software modules and descriptions thereof. In the case of a typical (not SARS _ ^), the service provider hosts the software module accessible through the network (one implementation of webservices). Service providers Define the service description of the Web service and release it to the service requestor or service registration center. Service Requests Use the lookup operation to retrieve service description from the local or service registration center, and then use the service description to bind and call the web service to implement or interact with the Web service. The service provider and service requestor role is a logical structure, so the service can represent two characteristics. The following figure illustrates these operations, providing components of these operations and interactions between them.
WebServices protocol stack
To perform publishing, discovery, and binding these three operations in an interoperable manner, there must be a WebServices protocol stack containing each layer. The figure below shows a conceptual WebServices protocol stack. The above layers are based on the functions provided below. Vertical strips indicate the need to meet each layer in the protocol stack. The text on the left represents the standard technology applied to the layer of the protocol stack.
The following is a rough instructions in each layer of the conceptual protocol:
The first layer (NETWORK): These protocols are now useful to use a relatively broad agreement. Now the most HTTP is using the most, the advantage is obvious, and I don't have much to say anything else. (Mainly I am afraid that I will say that it will be wrong, and everyone is laughing. * _ *).
How to call WebServices in the layer of XML-Based Messaging. There are two mainly available in the current use of XML-RPC (XML-REMOTE Procedure Call), one is SOAP (Simple Object Access Protocal). In contrast, SOAP has a certain advantage than XML-RPC: SOAP is more likely to handle complex data (such as arrays, etc.) is more likely to be more likely to XML-RPC; XML-RPC has no standardized error code; let's look at SOAP: What is SOAP?
A simple understanding of SOAP:
SOAP is an XML Application, SOAP simple understanding, this is an open protocol SOAP = RPC HTTP XML: Using HTTP as the underlying communication protocol; RPC as a consistent call approach, XML as a data transfer format, allowed service Provider and service customers communicate interact with the firewall in the Internet. As shown below:
A more step-by-step to SOAP:
SOAP Simple Object Access Protocol is a simple protocol for exchange information in a dispersion or distributed environment. It is an XML-based protocol that includes four parts: SOAP package (Envelop), encapsulation defines a description message is What is sent, who should accept and handle it and how to handle their framework, as shown below; SOAP coding rule (Encoding rules), used to represent the application of the data type required to use, generally follow XMLSChema (defined A series of simple data types) specification; RPC REPC Representation, represents an agreement for remote procedure calls and answers; SOAP Binding, exchange information using underlying protocol. Although these four parts are part of the SOAP, as a whole, they are defined, but they are functionally intersecting, independent of each other. In particular, envelopes and coding rules are defined in different XML namespaces, which makes it easier to define.
Figure: SOAP package (envelop)
Let's take a look at an example of SOAP:
[pre] Post / Calendar-Request HTTP / 1.1
Host: www.todaytech.com.cn
Content-type: text / plain; charset = "UTF-8"
Content-Length: 507
SOAPACTION: ""
XMLns: XSD = "http://www.w3.org/2001/xmlschema" xmlns: xsi = "http://www.w3.org/2001/xmlschema-instance"> SOAPENV: EncodingStyle = "http://schemas.xmlsoap.org/soap/encoding/" XMLns: ns1 = "http://external.charge.gfmis.todaytech.com"> ns1: searchPayNoteResponse> XSI: Type = "NS2: ExternalPayNotevo" XMLns: sopenc = "http://schemas.xmlsoap.org/soap/encoding/" XMLns: ns2 = "http://vo.charge.gfmis.todaytech.com"> MULTIREF> soapenv: body> soapenv: envelope> [/ pre] SERVICE DESCRIPTION: Mainly in this layer, the description of our services, explains our services to the client, tell the client, our provider, what kind of interface is available (what), how to go Call (how) to the call (where). The main protocol in this layer is WSDL (Web Services Description Language). WSDL is an XML Application, its role is to describe the WHAT, how, where, where our interface is described, that is, the WSDL service is defined as a distributed system to provide a machine-identified SDK document, and can be used to describe automatic execution The details involved in the application communication. The WSDL document defines the web service as a collection of service access points or ports. In WSDL, since the abstraction definition of the service access point and message has been separated from a specific service deployment or data format binding, the abstract definition can be used again: message, refers to the abstract description of the exchange data; and the port type , Referring to an abstract collection of operations. Specific protocols and data format specifications for specific port types constitute bindings that can be used again. Associate a web access address with the re-used binding, you can define a port, and the port of the port is defined as a service. Therefore, the WSDL document uses the following elements in the definition of the web service: • Types - Data Type Defined Container, which uses some type of system (generally using type system in XML Schema). • Message - Abstract type definition of the data structure of the communication message. Use Types defined by Types to define the data structure of the entire message. • Operation - Abstract description of the operations supported in the service, typically a single Operation describes a request / response message pair for accessing portals. • PortType - Abstract collection for the operations supported by an access point type, which can be supported by one or more service access points. • Binding - Bindings for specific protocols and data format specifications for specific port types. • Port - Defined a single service access point for the protocol / data format binding to the specific web access address. • Service - Collection of related service access points. We can refer to the following picture to understand the structural organization of the WSDL document: Description: Among them, Types is a container defined by a data type that includes all type definitions of the XML elements required in the message definition, which generally follows XMLSChema specification. Message specifically defines the data structure of the message used in the communication, and the Message element contains a set of Part elements, each Part element is an integral part, and each Part references a DataType to represent its structure. Part elements do not support nested (you can use DataType to complete this), all appeared in parallel. PortType specifically defines a type of service access entry, what is the type of access to the entrance? It is the pattern of incoming / outline messages and its format. A PortType can contain several Operation, and an Operation refers to a type of call supported by access portions. Supports four ways to call the portal call in WSDL: Single request; 2. Single response; 3. Request / response; 4. Response / request. Service description is a specific detail of all access portals provided by a specific deployed Web service, and a service will often contain multiple service access portals, while each access portal uses a port element to describe. Port description is a deployment details of a service access entry, including which web address (URL) is accessed, and how to use what message call mode should be used. The message call mode is represented using a binding structure. The Binding structure defines a porttype and a specific network transport protocol or message transfer protocol. From this level, the description is related to the deployment of the specific service. For example, you can bind PortType to SOAP / HTTP, or you can bind PortType to MIME / SMTP. Let's give a WSDL document instance: [pre] XML Version = "1.0" encoding = "UTF-8"?> XMLns = "http://schemas.xmlsoap.org/wsdl/" XMLns: ApacheSoAP = "http://xml.apache.org/xml-soap" XMLns: IMPL = "http://external.charge.gfmis.todaytech.com-impl" XMLns: intf = "http://external.charge.gfmis.todaytech.com" XMLns: sopenc = "http://schemas.xmlsoap.org/soap/encoding/" XMLns: TNS2 = "http://vo.charge.gfmis.todaytech.com" XMLns: wsdl = "http://schemas.xmlsoap.org/wsdl/" XMLns: wsdlsoap = "http://schemas.xmlsoap.org/wsdl/soap/" XMLns: xsd = "http://www.w3.org/2001/xmlschema"> XMLns = "http://www.w3.org/2001/xmlschema"> sequence> complextype> WSDL: TYPES> wsdl: message> wsdl: message> wsdl: message> wsdl: message> wsdl: message> wsdl: message> wsdl: message> wsdl: message> wsdl: Operation> wsdl: Operation> Name = "genpaynoteRequest" /> Name = "genpaynoteesponse" /> wsdl: Operation> Name = "searchpaynoteRequest" /> Name = "searchPayNoteResponse" /> wsdl: Operation> wsdl: porttype> TYPE = "INTF: EXTERNALINTERFACE"> Transport = "http://schemas.xmlsoap.org/soap/http" /> EncodingStyle = "http://schemas.xmlsoap.org/soap/encoding/" Namespace = "http://external.charge.gfmis.todaytech.com" Use = "encode" /> wsdl: input> EncodingStyle = "http://schemas.xmlsoap.org/soap/encoding/" Namespace = "http://external.charge.gfmis.todaytech.com" Use = "encoded" /> wsdl: Output> wsdl: Operation> Namespace = "http://external.charge.gfmis.todaytech.com" Use = "encoded" /> wsdl: Input> Namespace = "http://external.charge.gfmis.todaytech.com" Use = "encoded" /> wsdl: Output> wsdl: Operation> Namespace = "http://external.charge.gfmis.todaytech.com" Use = "encoded" /> wsdl: Input> Namespace = "http://external.charge.gfmis.todaytech.com" Use = "encoded" /> wsdl: Output> wsdl: Operation> Namespace = "http://external.charge.gfmis.todaytech.com" Use = "encoded" /> wsdl: Input> Namespace = "http://external.charge.gfmis.todaytech.com" Use = "encoded" /> wsdl: Output> wsdl: Operation> wsdl: binding> wsdl: port> wsdl: service> WSDL: Definitions> [/ pre] The fourth layer (Service publication): Service Discovery: These two layers are about UDDI agreements. We don't use it for the time being, and now there is no time, it will make up (^ _ ^). Author Blog: http://blog.9cbs.net/tansf/