Web Service Overview

Source: Internet
Author: User
Tags format definition soap wsdl


Introduction to Web Service

Web Service is a universal model of building applications that can be run in any operating system that supports network communication; it is a new branch of Web application that is a self-contained, self-describing, modular application that can be published, positioned, and called through the web. A WEB service is an application component that logically provides data and services to other applications. Each application accesses the Web service through a network protocol and some standard data formats (HTTP,XML,SOAP), resulting in the desired results through a Web service internal execution. Web Service can perform any function from simple requests to complex business processing. Once deployed, other Web service applications can discover and invoke the services it deploys.

The following key techniques and rules are used when building and using Web Service:

1) XML: A standard method of describing data.
2) SOAP (simple Object Access Protocol): The protocol that represents the exchange of information.
3) WSDL (Web Services Description Language): Web Service Description Language.
4) UDDI (Universal Description, Discovery and Integration): General description, Discovery, and integration, a platform-independent, XML-based protocol for describing commerce on the Internet.

1. What is a Web Service?

A web Service is a network component (a program that can be accessed over a network). It has one or more ports (port) that are used to receive requests from clients and return response requests and responses that are an XML-based message. However, this message follows a specific format (SOAP).

2. How do I invoke a Web Service?

It might be less accurate to say, "How to invoke operations defined in a Web service", each Web service has a description file (WSDL) that describes the following aspects of a Web service:

1) The Port of the service (the port that receives the SOAP message)
2) operation provided by the service
3) Definition of the input/output format of the operation (input/output format defined by XmlSchema)

With the description file (WSDL) of the Web service, we know how to invoke the operation defined in this Web service?
1) Find the operation you want to invoke through the operation provided by the service;
2) Find the input format definition (XmlSchema) of this operation, construct a SOAP message according to this input format;
3) Send this SOAP message to the specified port of the service;
4) Prepare to receive a SOAP response returned from the Web service server!

3. WEB Service server?

A web Service server that is essentially the same as a Web server. It mainly does the following things:

1) Monitor network port (listening service port)
2) Receive client requests (receive SOAP requests)
3) Parsing client requests (parsing SOAP messages, converting SOAP messages to data Objects)
4) Invoking the business logic (invoking a specific operation of the Web Service implementation class, the parameter is a data object converted from a SOAP message)
5) Generate a response (converts the return value to a SOAP message)
6) return response (return SOAP response)

4. What is WSDL?

1) WSDL refers to the Network Service Description Language
2) WSDL is written using XML
3) WSDL is an XML document
4) WSDL is used to describe the network service
5) WSDL can also be used to locate network services
6) WSDL is not a standard

WSDL can describe a network service (Web services), which refers to a network Service description language. is a document written using XML that describes a Web service. It can specify the location of the service and the operation (or method) provided by the service.
A WSDL document is simply a simple XML document that contains a series of definitions describing a Web service.

The WSDL document structure (the WSDL document uses these main elements to describe a Web service):

The main structure of a WSDL document is similar to this:

Copy Code
<definitions>
<types>
Definition of types .....
</types>
<message>
Definition of a message ....
</message>
<portType>
Definition of a port ....
</portType>
<binding>
Definition of a binding ....
</binding>
</definitions>
Copy Code

PS: In fact, the above structure can be opened with a browser to a specific WebService view. A WSDL document can contain other elements, such as the extension element, and a service element that can combine the definitions of several Web services into a single WSDL document.

WSDL Structure Description:

WSDL Port:

The <portType> element is the most important WSDL element. It can describe a Web service, operations that can be performed, and related messages. You can compare <portType> elements to a library of functions (or a module, or a class) in a traditional programming language.

WSDL message:

The <message> element defines a data element for an operation. Each message is made up of one or more parts. These parts can be compared to the parameters of a function call in a traditional programming language.

WSDL types:

The <types> element defines the type of data used by the Web service. For maximum platform neutrality, WSDL uses XML Schema syntax to define the data type.

WSDL Bindings:
The <binding> element defines the message format and protocol details for each port.

WSDL instance:
This is a simplified fragment of a WSDL document:

Copy Code
<message name= "Gettermrequest" >
<part name= "term" type= "xs:string"/>
</message>
<message name= "Gettermresponse" >
<part name= "value" type= "xs:string"/>
</message>
<porttype name= "Glossaryterms" >
<operation name= "Getterm" >
<input message= "Gettermrequest"/>
<output message= "Gettermresponse"/>
</operation>
</portType>
Copy Code
In this example, the,<porttype> element defines "Glossaryterms" as the name of a port, and "Getterm" is defined as the name of an operation. The operation "Getterm" has an input message named "Gettermrequest" and an output message named "Gettermresponse".
The <message> element defines the part of each message and the associated data type. In contrast to traditional programming, glossaryterms is a library of functions, while "getterm" is a function with the input parameter "Gettermrequest" and the return parameter gettermresponse.

Soap

In order to package RPC request information, XML-RPC was introduced, but XML-RPC can only use a limited number of data types and some simple data structures. A soap (simple Object Access Protocol) appears. The main work of soap is to use standard XML to describe the RPC request information (uri/class/method/parameter/return value). Theoretically, soap is a piece of XML, you can send it through HTTP,SMTP, etc. (Copy to floppy disk, call courier company to send it?). The same soap is also cross-lingual.

Wsdl

WSDL (Web Services Description Language) is a description of the Web service and describes how to access the Web service. WSDL is used to describe soap, in other words, the WSDL file tells you everything you need to know to invoke soap. WSDL is also a section of XML. The WSDL support is now mature for each language, and it is possible to generate a client of its own language based on the same WSDL file.

Web Service Overview

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.