SOAP overview

xiaoxiao2021-03-06  61

In the movie fight club ("War Club"), Brad Pitt and Edward Norton are two extremes of the two extremes. Two young guys tried to communicate with each other, but it is very difficult. Interesting is that there is no prompt line ?? Most of the plots in the film are carried out around the production of soap, it seems like a plurality of characters are unique, and it is unexpectedly tied together. .

Now quickly go to a different type of plot, these two software secrets of Microsoft and Sun also show this plot in the Internet, each of them with a well-defined point of view, trying to bridge the differences between Heng, and another A communication line is established between. Enter SOAP, that is, a simple object access protocol.

Introduction

SOAP, briefly, is to allow Java objects and COM objects to talk to each other in distributed, dispersed, web-based environments. More general, SOAP allows any type of object (or code) to communicate with each other on any platform. Currently, SOAP has been implemented in more than 60 languages. Suddenly, anywhere, no matter whether local or remote, regardless of large or small, can be interoperable. Brad Pitt and Edward Norton, like two distinctable objects, eventually communicate.

Review this technique, I started to introduce SOAP in the WEB service to SOAP, SOAP as an agreement, which provides business room registration and messaging services with UDDI (General Description, Discovery, and Integration). I will also discuss the web-based foundation of the "Publish-Find-Binding" paradigm and introduce SOAP packaging, transfer, and transmit mechanisms.

Development of Web services

First put all the publicity of all the big shares, SOAP is just a component ?? Although it is a central component ?? It is used to describe the blueprint of the Web into business operations, standard, language and platform neutrality Architecture. These business operations are usually marked with a general label of "Web Services", but the web service itself is just a good foundation that supports them. Accordingly, the Internet has a fast N-layer foundation.

Network layering

Three network layers are obvious: TCP / IP, HTTP / HTML, and XML, in the development of Web services. Now these three layers are built on top of each other and remain compatible with each other.

Layer 1, TCP / IP protocol, mainly focused on the transfer of data in packet form. As a protocol, TCP / IP emphasizes the reliability and physical connectivity of data transmission through public network transmission. At first, the private network was bonded together, and now use the web center agreement to connect to the network. Higher levels of standard protocols such as HTTP are dependent on this central protocol.

Layer 2, HTML on HTTP, it is a display layer, and it is paying attention to the browser search, retrieval, and information sharing. It emphasizes the processing based on the navigation and display format of the GUI (graphical user interface). In many ways, HTML is more useful for display, rather than moving to another web page, and is lacking in scalability and true programming capabilities. Nonetheless, a document sharing a super text link in a browser environment causes people to communicate with others in the way people communicate with others. Network desktop environment, limited to the platform-dependent software, slow speed, no doubt will make the road based on standard, open Internet.

Turn this responsibility to this brave, new, standard-based world is XML, it is the 3rd floor of the Internet, or the most compelling layer. XML, a strong type of data exchange format, which provides a new range for the HTTP / HTML layer. In the XML layer, the communication of machines to machines may be performed by standard interfaces. How many different descriptions, such as A2A (application to applications), B2B (businesses), or C2C (computer to computer) ?? Allow programs to exchange data formats and display? ? Independent programming way. The XSLT style sheet can be added as an alternative display and / or transmitable component to add. XML: Describe the key to the Web service

The key to this possibility is to realize the communication of machines to machines, which is what XML is capable. As a description of data, XML is the definition drive (by using DTD and architecture) and allows information to program. This means that most of the considerable work can be taken from B2B communication. You can have a consistent mark, you can define an interface, or process can also be standardized. The web service is a reusable component program that uses XML as a standard, scalable communication architecture to facilitate the communication of machines to machine types.

The web service provides interfaces for component data and business logic transmitted by HTTP. A large amount of data is placed behind the server-side script, waiting for access by a web browser or client program. Web services commitments have made new students in many companies in the company, where they are in idle state.

XML plays a crucial role in the business logic of data integrating data in the Web to enterprise applications and coordinated for component slice. Specific business logic and services (including workflow logic, business logic, component sequence logic, transaction logic, etc.) can be sealed in an XML document and integrated into an existing business environment. This allows business between internal resources and web services, simplifies business transaction logic and providing a leverage between the web with a chain interaction.

Since XML is the architecture of the WEB service that can be used for the XML is the text-based, it is ideally used as an architecture of the transfer of loose coupling. The minimum is: Automated transactions increase productivity, reduce fees and improve services. The existence of network standards makes automated transactions, making it possible to improve all members' productivity.

SOAP is an earlier XML standard technology, and the early XML standard is a display standard called EBXML (e-commerce XML). EBXML has a continuous logic that sequentially, which provides a comprehensive definition of sharing business messages between trade collaborators. SOAP is applicable to more common and easier to implement.

Loosely coupled system

The Web Services separates objects from managed their platforms, that is, the web service is easier to interact between the platforms of the platform, and the object can access the data on the Web. As part of the dedicated platform, the Web service depends on loose rather than closely coupled Web components. Depending on Brian Travis (SOAP Advisory and Author), "The system that depends on dedicated objects is considered coupling, because they rely on a well-defined but very fragile interface. If the application is in any part of the application and service object Interrupt, or if the call is not completely correct, an unpredictable result will occur. "EDI is an example of an architecture used to perform an electronic commerce. Song-coupled systems allow flexible and dynamic exchanges in an open, distributed web environment.

Corba's second time

Companies on the Internet? IBM, BEA, Sun, just a few examples of examples ?? At the same time cooperation with companies competing with them. Standardized network transport protocols, independent of platform-based programming languages ​​such as: Java, XML, and specific industries, and open-component-based server architecture enable everyone to enjoy non-specific resources for free. Now, Web services, with its commitment to interoperability to include extensive applications, like a final "glue", interacting these technologies, even not seamless, at least not exceeding the previous technology Corba and RMI have brought. In a sense, the Web service represents the second coming of CORBA. However, CORBA is an object-oriented, IIOP-based binary communication architecture, which is made of foundation, skeleton, and supplier-loaded ORBs; the web service is light, based on HTTP-based, XML driver and platform And language is completely neutralized. If CORBA is a heavy 600 pound gorilla, the web service is a small antelope, which is freely jumped in the vast Internet penalty area.

Publish, bind and look up

The architecture of the web service is published by the release-find-binding this week, which makes the data, content, and service can be used by the service provider, and the service requestor uses resources by positioning and binding to the service. . The request application uses the WSDL (Web Service Description Language) to transfer the requester to the web service. WSDL provides a low-level technical information for the desired service, and authorizes to access the XML architecture information about data encoding, and ensure that the correct operation is called by the correct protocol.

Publishing, binding, and finding mechanisms have their respective copies in three independent (but some) protocols, which are WSDL, SOAP, and UDDI (General Description and Discovery Interface), which forms a web service network Stack.

The Corba's deeper classes can be found that SOAP acts as a role in IIOP (or JRMP in RMI) in CORBA. It is a binding mechanism between the opposite endpoints. On the other hand, WSDL acts as a role of IDL (interface description language). In this feature, WSDL defines web services to a collection of ports and operations. The WSDL port is an analog interface, and the WSDL operation is analog method. WSDL publishes the Web service interface to those who are interested in crossing different platforms.

However, WSDL has exceeded an interface definition language; it also contains constructs that allow for web service description addresses and protocol information to be published. About WSDL's exciting thing is that it describes an abstract interface for web services while allowing you to bind Web services to specific transport mechanisms such as HTTP with unbearable details. By making interfaces abstract, WSDL can be used as a reusable web service technology. WSDL is gathered by the abstract class by binding to a particular transmission mechanism. If this looks some contradictions, you can think of space planes: it is reusable, but you want to completely bind the full machine space cabin to dedicated, but unrecognized booster rockets. The transmission mechanism may change, but the payload will remain.

Finally, UDDI is used to register publishing and looking for web services. In a web-based registration, by displaying service information and binding interfaces, UDDK provides a shared directory for business and customers to find someone's Web services.

Build a web service

SOAP allows you to build an application via a way to remotely call the object. SOAP eliminates two systems must run on the same platform, and must be required by the same programming language. The SOAP package is not a method of calling a dedicated binary protocol, but a lexical of this basic text using XML. Request all information between the application and the received object, is sent as the tag data in the XML stream via HTTP. From a web service perspective, SOAP can be considered as a client or server implementation. SOAP client and server

The SOAP client is a program that creates an XML document, which is included in the distributed system. The SOAP client is not a traditional program that can be a web server or a server-based application except for normal desktop applications.

Messages and requests from the SOAP client are typically sent via HTTP. Thus, the SOAP document can pass through almost all firewalls, so that information can be exchanged across different platforms.

The SOAP server is just a special code for listening to the SOAP message, which can be used as the allocator and interpreter of the SOAP document. External Web Services can interact with J2EE technology-based applications, which can handle SOAP requests for multiple clients.

The SOAP server ensures that the document received through the HTTP connection is converted into a language that can be understood by the other end. Since all communications use an XML format, objects in some languages ​​(such as Java) can communicate with objects in another language (such as C ) through SOAP. The work of the SOAP server is to ensure that all ends can understand and satisfied with the SOAP that serves them.

SOAP and Java technology

According to SOAP 1.1 specification, SOAP is "a light protocol for exchange information in dispersed, distributed environments." SOAP does not entrust a single programming model ?? Nor does not define language bindings for specific programming languages. In the Java programming locale, it depends on the Java team to define a specific language binding. Now Java language bindings are set in the JAX-RPC.

In the recent Javaone Developer Substance, SUN's engineer Roberto chinnici and Rahul Sharm screamed JAX technology families "use familiar, JSP and EJB component technology for Java platforms to create web services ". Servlets and stateless session beans are referenced to Java technology that is most likely to encapsulate Web services.

What is soap? really?

We have completely set up the SOAP stage and describe its critical role in the web service. Now let's take a look at what SOAP is, what tasks do it do, and how to do?

SOAP is an extensible, text-based architecture that allows communication between different roles. The roles here generally refer to objects, which do not know the platform or other party. From the perspective of the network object, SOAP is the last invisible form of them. The client application can interoperate in a loosely coupled environment to discover and dynamically connect to the service, and this does not need to establish an agreement between applications and services in advance.

SOAP is scalable because there is no need to interrupt existing applications, SOAP clients, servers, and protocols themselves. Moreover, SOAP can excellent architecture of intermediate media and hierarchical architecture. This means that the processing node can put the requested path outside the client and the server. The intermediate node processes the part of the SOAP specified by using the header (which part of which node is used to process which message is used). This type of intermediate header processing is performed through a private contract between the client application and the intermediate processing node. SOAP provides a MUSTUNDERSTAND attribute for the header that allows the client to specify whether to be executed or optional. If the MUSTUNDERSTAND is set to 1, the server must perform the intermediate processing or an error specified by the header. SOAP also defines data coding rules, called reference coding or "Section 5 (Section 5)" encoding, which is the section that describes data coding rules from the SOAP specification. It should be noted that SOAP encoding content accounts for most of the space in the SOAP 1.1 specification 40 pages. Don't have to go deep into the XML data type details ?? It is still a scope of experts in the XML architecture setup group. The SOAP encoding can be shortly described as a collection of simple values ​​or complex values.

The simple value can be a simple type, such as integer, floating point, and character type, or the built-in type defined in the second part of the XML architecture specification, including various data types, such as byte arrays and enumerations.

The composite values ​​include complex types defined by structural, arrays, and XML architectures. Finally, of course, not at least, SOAP data coding specifies the mechanism of object serialization rules, namely the network arrangement and dispersion of data streams. These "Section 5" encodings are not mandatory under any circumstances, pay attention to this, so that the client and server can freely use different data coding specifications as long as they meet the format. But if you do this, you will destroy SOAP to provide standardized services on the network, and bring a common warning: It has been deviated from the route, and a separate client and server can choose a short travel route.

Finally, SOAP has established a set of rules that allow clients and servers to use SOAP as a communication architecture to perform remote procedure calls. SOAP ?? As a message-oriented protocol ?? You can use these norms as well as the RPC type. The mechanism of object serialization provides vitality to SOAP-RPC.

Message format

SOAP can do all it can complete in a standardized message format environment. The body part of the message is the "Text / XML" form of MIME type and includes a SOAP envelope. This envelope is an XML document. The envelope contains a header (optional) and packets (must be there). The packet part of the envelope is always used for the final reception, and the header project can determine the target node that performs intermediate processing. Attachments, binary numbers and other projects can be attached to packets.

SOAP provides a way to give the client which intermediate processing node must handle a header project. The main content of the header and the SOAP message is not related to each other, so they can be added to the message, without affecting the processing of the message packet.

For example, a header can be used to provide a digital signature for the request contained in the packet. In this case, the authentication / authorization server can handle the header project ?? Independent message can be peeled off to verify the signature. Once verified, the rest of the envelope will be passed to the SOAP server, which will process the message of the message. In-depth research, the SOAP envelope, which helps to clear the location and use of the SOAP header and packet elements.

Analysis SOAP envelope

The SOAP 1.1 specification provides the following envelopes:

SOAP-ENV: Mustunderstand = "1" 5 Def In this example, getLastTradeprice The request is transmitted to a storage-reference service to a location on the network. This request comes with a character type parameter, a order symbol, and returns a floating point number in the SOAP response.

The SOAP envelope is the top element of the XML document representing the SOAP message. XML namespaces are used to separate SOAP identifiers to the specific identifier of the application. XML Namespaces are used frequent in SOAP to limit the scope of the elements of the message in a particular area. Understanding the SOAP namespace helps to familiarize with XML naming norms. If you don't understand the namespace, you can simply treat it as an adjacent identifier, which helps uniquely identify the SOAP element by associating the SOAP element with a specific location (real or imagination). .

The first namespace in the above example above refers to the SOAP mode of defining elements and properties in the SOAP message. The second namespace refers to SOAP encoding, which is the "Section 5" data type discussed above. This coding will apply to the entire document because there is no additional general element encoding.

The first element identified in the SOAP envelope header example is a Transaction element with a namespace properties and a virtunderstand property of one value 1. Since Mustunderstand's property value is set to 1, the server that accepts the message must perform intermediate processing on the Transaction node. You can explain this way: The server is reached in the semantics of the handle element processing in advance, so that the server knows the contents of the elements to be processed, and the contents of the elements in this example are "5".

If the server that receives the message does not understand the semantics of the Transaction header, it will refuse the request and throw an error. The error element is a special part of SOAP packets and define a good mechanism to send error messages to the client.

An intermediate processing node like this is an example of SOAP scalability. The client contains such a node in the SOAP message to indicate the special processing needs to occur before the message can be processed. To ensure that the existing server that cannot be provided backward cannot provide this processing, simply set the MUSTUNDERSTAND attribute to 0, which makes the operation optional.

In addition to defining the Transaction node shown in the above example, the SOAP message can also include a header project, which is used to specify the node to perform authentication processing, encryption, state of permanent, business logic processing, etc. The header helps to construct SOAP into an extensible modal package model. Just remember that the header processing is completely unique to the message of the SOAP message.

The SOAP packet in the above example of the message contains an XML load, and we can speculate that the RPC does not explain it to us. SOAP is not only a model package model, but it is a fairly mysterious package model. There is nothing signs that the RPC will start to do. We see a few XML elements in the packet, one of which is restricted with namespace. It depends on the SOAP server understands the text semantics and performs the correct process. In fact, the server provides an architecture that handles XML load in a meaningful manner. The "meaning" here means that the server calls the remote process on some background databases to receive stock prices for stock - symbol elements contained in the message packet. All these magic operations occur behind the SOAP RPC.

SOAP-RPC

The SOAP message is essentially one-way transmission from the sender to the recipient, but SOAP is often combined into a real request / response mechanism. To make RPCs use SOAP, you must follow several rules. First, the request and response message must be encoded into a structural type. Each input parameter for an operation must have one of the same name elements (or member of the input structure) as a parameter. For each output parameters, there must be a name matching element (or member of the output structure).

Based on RPC-based perspectives will omit some SOAP messages that are displayed earlier. The SOAP request and response enclosure with the packet part is as follows:

Request Def Response 22.50

Request to call the GetLastTradePrice method. Note The response defines the GetLastTradePriceResponse operation. A common SOAP call rule for additional response to the response operation tail is: Creating a response structure. Such an output structure contains an element named price, which returns the result of the method call, assumes a floating point.

There is no local data type in the SOAP envelope is explicitly declared, notice this is important, so if only SOAP messages are viewed, you will not know the type of symbol type or result parameter Price. Client applications typically define data types through the "Section 5" encoding, or define data types by protocol reached privately with the server. In either case, these definitions contained in the SOAP message are not explicit.

Finally, in order to carry out RPC, a low-level protocol is required such as HTTP. Although the SOAP 1.0 specification enforces the use of HTTP as a transport protocol, the SOAP 1.1 specification (and its sister specification "SOAP message with attachment") allows the original TCP / IP socket to be used. All of these serialization and coding rules for SOAP are also applicable to RPC parameters.

SOAP case

Figure 1: SOAP use case processing steps

Now that you see is a detailed SOAP envelope. It can help us with a step from the perspective of the use case to help us understand a process of recurring in a distributed web environment. Several concepts of concept central, dedicated, outstanding, and outstanding, outlined, outlined, outdoor are listed here.

The client application on the Internet uses web services. Web services (via SOAP) display object methods. The object method accesses the remote data of any location on the Web. Transfer logic for these network proposition applications, we can conclusions to Web services and SOAP: some locations of the client to make the data on the web. This is what you have to prove.

The following is a more detailed use case.

The SOAP client uses UDDI registration to find web services. Without the WSDL without direct operation, the SOAP application will hard connect to the binding of ports using specific types and specific styles, and it will be called by UDDI dynamic configuration, the service address that matches the web service. The client application creates a SOAP message, which is an XML document that can perform the desired request / response operation. The client transmits the SOAP message to the JSP or ASP page on the Web server listening to the SOAP request. The SOAP server parses the SOAP package and calls the appropriate object method in its field to pass in the parameters included in the SOAP document. Before the SOAP server receives the message, the intermediate processing node can perform the special function indicated by the SOAP header, and the situation determines if this step is performed. Request the object to perform the function of the indication and return data to the SOAP server, which package the response into the SOAP envelope. The server puts the SOAP envelope to the response object to be sent back to the requesting machine, such as a servlet or COM object. The client receives the object, peel off the SOAP envelope and transmits the response document to the program initially issued, and completes the request / response cycle.

summary

SOAP is an XML-based protocol that is used to send messages in a distributed environment and perform remote process calls. Using SOAP, data serialization can be made without considering any particular transport protocol (although the HTTP protocol is usually selected).

Building SOAP to build a platform and language neutral interoperability is a good choice. In short, SOAP and Web services have considered everything you need to build a distributed application infrastructure on XML. Soap minimizes multiple platforms when accessing data is minimized by addressing conflicts between COM and Java component object models.

First put these discussions one side, SOAP is an ideal medium for all types of object entities ?? Even for Hollywood movie roles like BRAD PITT and EDWARD NORTON ?? can also be used as a communication medium. Just like in the movie, I look forward to this new technology to bring the effect of shocking the world.

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

New Post(0)