Getting started with WebServices

xiaoxiao2021-03-06  72

http://dev.9cbs.net/develop/Article/52/52599.shtm

Getting started with WebServices

[pre] WebServices Getting Started - Theory Ruiyi Technology (China) Co., Ltd. Li Chunlin [/ pre] This document is an entry-level document that produces Ctrl C -> Ctrl V, mainly what is WebServices, WebServices Architecture, as well as 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 through 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). The WebServices model WebServices architecture is based on 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 WebServices components: 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. The WebServices protocol stack To perform the 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): This level of these agreements are now using a wide range of protocols, now HTTP is used up to Oh, the advantage is obvious, 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 route, XML As the format of data transfer, the service provider and service client allows communication interaction to communicate in the Internet. As shown below: Detailed understanding of SOAP: SOAP Simple Object Access Protocol is a simple protocol for exchange information in a dispersion or distributed environment, which is an XML-based protocol that includes four parts: SOAP package (Envelop), The package defines what is the content in a description message. Who should accept and process it and how to handle their framework, such as the following image; SOAP coding rule (Encoding rules), used to indicate the data you need to use The type of instance, generally follow XMLSChema (defined a series of simple data types) specification; the SOAP RPC representation indicates the protocol of the remote procedure call and the response; SOAP Binding, use the underlying protocol to exchange information. 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 us look at a SOAP example: [pre] post / calendar-request http / 1.1host: www.todaytech.com.cncontent-type: text / plain; charset = "UTF-8 "Content-Length: 507soapaction:" " 0300000003004 0.0 ycptewkew ​​ 0.0 0.0 0.0 1 0 < Enddate XSI: Type = "xsd: string" xsi: nil = "true" /> 0.0 0.0 < / Price2> 0.0 [/ PR E] Service Description: In this layer, it is mainly our service description, describing our services to the client, telling the client, what kind of interface is available (what), how to To 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: where Types is a data type defined container, which contains all the type definitions of the XML element 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. In WSDL supports four modes of access to the entry call: 1. 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.

Below we give a WSDL document instance: [pre]

"xsd: string" /> < Element name = "usersign" nillable = "true" type = "xsd: string" /> < / Schema>

"TNS2: EXTERNALPAYNOTEVO" /> < / WSDL: INPUT> < / wsdl: input> [/ pre] is the fourth layer (Service publication)

转载请注明原文地址:https://www.9cbs.com/read-87088.html

New Post(0)