Introduction to WebService soap and application scenarios

Source: Internet
Author: User

WebServiceIt is a universal model for building applications and can be run in any operating system that supports network communication. It is a new Web Application Branch, it is a self-contained, self-describing, and modular application that can be released, located, and called through the Web. Web Service is an application component that logically provides data and services for other applications. Each application accesses the Web Service through the network protocol and some standard data formats (HTTP, XML, and SOAP). The results are obtained through the internal execution of the web service. Web services can execute any function from simple requests to complex business processing. After deployment, other Web service applications can discover and call the services deployed by the application.

In fact, the main goal of WebService is cross-platform interoperability. To achieve this goal, WebService is fully based on XML (Extensible Markup Language), XSD (XMLSCHEMA), and other standards independent of the platform and software vendors, is a new platform for creating interoperable and distributed applications.

 

 

Technology and rules

  1. XML: Standard Method for describing data.
  2. Soap: indicates the Information Exchange Protocol.
  3. WSDL: Web Service Description Language.
  4. UDDI (Universal Description, discovery and integration): Universal Description, discovery, and integration. It is a platform-independent, XML-based protocol used to describe commerce on the Internet.

Bytes --------------------------------------------------------------------------------------

 

Soap: Simple Object Access Protocol, Simple Object Access Protocol (SOAP) is a lightweight, simple, XML-based protocol, it is designed to exchange structured and solidified information on the Web. Soap can be used in combination with many existing Internet protocols and formats, including Hypertext Transfer Protocol (HTTP), Simple Mail Transfer Protocol (SMTP), and multi-purpose Internet Mail Extension protocol (MIME ). It also supports a large number of applications from the message system to Remote Process calling (RPC.

Four Parts

Soap. N. Soap

  Soap: Simple Object Access Protocol

(Soap: Simple Object Access Protocol)

Soap consists of four parts:

Soap encapsulation: it defines a framework that describes the content in a message, who should handle it, and whether it is optional or necessary.

Soap encoding rules: it defines a serialization mechanism for exchanging instances of the data types defined by an application.

Soap RPC: it defines a protocol used to represent remote process calls and responses.

Soap binding: defines a protocol that uses the underlying transmission protocol to exchange soap encapsulation between nodes.

Soap messages are basically unidirectional transmission from the sending end to the receiving end, but they are often combined to execute a mode similar to request/response. All soap messages are encoded in XML format. A soap message is an XML file that contains an essential soap encapsulation package, an optional SOAP header, and a required soap block.

Binding soap to HTTP provides the advantages of using soap styles, scattered flexibility, and HTTP's rich feature libraries. Transmitting soap over HTTP does not mean that soap will overwrite the existing HTTP semantics, but that the soap semantics on HTTP will naturally map to the HTTP semantics. When HTTP is used as the Protocol binding, RPC requests are mapped to HTTP requests, while RPC responses are mapped to HTTP responses. However, using soap on RPC is not limited to HTTP binding.

Soap can also be bound to TCP and UDP protocols.

Protocol Structure

SOAP message format:

SOAP Header

<SOAP-ENV: Envelope

Attributes>

SOAP-ENV: Body

Attributes>

SOAP-ENV: Body>

</SOAP-ENV: envelope> is currently mainly used in Web Services.

Soapaction web encoding is common. It indicates the starting meaning of the Protocol and is common in the starting sentence of the encoding.

Syntax Rules

Here are some important syntax rules:

Soap messages must be encoded in XML.

Soap messages must use the SOAP envelope namespace

Soap messages cannot contain DTD references

Soap messages cannot contain XML processing instructions

Basic Structure of soap messages

<? XML version = "1.0"?>

<Soap: Envelope

Xmlns: Soap = "http: /// www./2001/12/soap-envelope"

Soap: encodingstyle = "http: // www.www./2001/12/soap-encoding">

<Soap: Header>

...

...

</Soap: Header>

<Soap: Body>

...

...

<Soap: Fault>

...

...

</Soap: Fault>

</Soap: Body>

</Soap: envelope>

 

Bytes --------------------------------------------------------------------------------------

Application scenarios of Web Service

In the past, distributed application logic used distributed object models by using basic structures such as DCOM, CORBA, and RMI, developers can still have the rich resources and accuracy provided by using local models, and can place services in remote systems.

Why do we have to worry about the web when we already have a favorite middleware platform (such as RMI, Jini, CORBA, and DCOM? Middleware does provide powerful service implementation means, but these systems share a common defect that they cannot be extended to the Internet: they require that the service clients and the services provided by the system must be closely coupled, that is, a similar basic structure is required. However, such a system is often very fragile: if the execution mechanism at one end changes, the other end will crash. For example, if the interface of the server application is changed, the client will crash. To expand to the Internet, we need a loosely coupled structure to solve this problem. In some cases, the emergence of Web Services has emerged. Web Service is a programmable component based on the standard web protocol. We can regard Web Service as a Web component, and Web Service Providers open a series of APIs, developers call these APIs to integrate Web services and build their own applications.

1. Soap

Soap (Simple Object Access Protocal) is a simple protocol for information exchange in distributed or distributed environments. It is based on the XML protocol, XML provides a simple and lightweight mechanism for exchanging structured and type information in a distributed or distributed environment. It does not define any application semantics, for example, the implementation of programming models or specific semantics defines a simple mechanism for expressing application semantics by providing a package model with standard components and encoding data in modules, enables it to be used in various systems that transmit information to RPC. The SOAP specification defines the format of soap messages and how to use soap over HTTP. The most striking feature of soap is that it can be implemented on many different software and hardware platforms. This means that soap can be used to connect different systems inside and outside the enterprise. I have tried multiple methods to propose a universal communication protocol for system integration in the past, but they are not widely recognized as soap. Why? Because soap is smaller and easier to implement than many earlier protocols. The popularity of HTTP and the simplicity of soap make it possible to call them in almost any environment, thus becoming the ideal basis for XML Web Services.

2. WSDL

How do you introduce to others the functions of your Web Service and the parameters for each function call? You may write a set of documents by yourself, or even verbally tell people who need to use your web service. These informal methods have at least one serious problem: when programmers sit in front of a computer and want to use your web service, their tools (such as Visual Studio) they cannot provide any help, because these tools do not know your web service at all. The solution is to provide a formal description document using machine readable methods. The Web Service Description Language (WSDL) is an XML-based language used to describe Web services and their functions, parameters, and returned values. Because it is based on XML, WSDL is both readable and readable, which is a great benefit. Some of the latest development tools can generate a WSDL document based on your web service, and import the WSDL document to generate code that calls the corresponding web service.

3. UDDI

UDDI (General discovery, description, and integration) is the yellow pages of Web Services. Is a set of web-based and distributed implementation standards that provide information registration centers for Web Services, it also contains a set of access protocols that enable enterprises to register their web services so that other enterprises can discover them. Like the traditional yellow pages, you can search for the companies that provide the services you need, read about the services you provide, and contact someone for more information.

Interesting understanding

A Web Service is like a service provider that provides basic services to other manufacturers. Other manufacturers then package the services into their own products or services for others or their own use. It's a bit like OEM. Since the two companies need to cooperate, it is impossible to rely on one sentence, and some standards and specifications need to be achieved. So:

Soap is like a contract signed between two companies, binding both parties to follow certain rules and standards.

WSDL is like a manual, telling others what you have and what services you can provide to others.

For example, your company needs to register in the Yellow Pages or in the industrial and commercial areas. The enterprise's main business registration is convenient for others to query. Of course, you can also not register in UDDI, just as you do business in the basement and rely on verbal drinks. But if you want to expand the market, you need UDDI to be discovered by customers, it is easier to find you.

Web Service is a new platform for creating interoperable distributed applications. The main goal of Web Service is cross-platform interoperability. To achieve this goal, Web services are fully based on XML, XSD, and other standards independent of platforms and software vendors. Web service is very useful when applications communicate across platforms and networks. Web Service is suitable for application integration, B2B integration, code and data reuse, and communication between clients and servers through the Web.

Of course, Web services are not omnipotent. You cannot abuse web services everywhere. In some cases, Web Service Reduces the application performance without any benefits. For example, a homogeneous application running on a machine or a LAN should not communicate with Web Services.

So far, we have discussed how to communicate with Web Services (SOAP), how Web services are described (WSDL), and how to find Web Services (UDDI ). These contents constitute a set of basic specifications and provide the foundation for Application Integration and aggregation. Based on these basic specifications, companies can build and benefit from practical solutions.

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.