Web Service brief introduction
Web Service It is a universal model for building applications that can run in any operating system that supports network communication; it is a new branch of web application, a self contained, self described and modular application that can be published, located, and invoked by web. Web ServiceIt is an application component, which logically provides data and services for other applications. Applications access Web Service through network protocols and some standard data formats (Http, XML, Soap), and are implemented internally through Web Service.The required results. Web Service can perform any function from simple request to complex business processing. Once deployed, other Web Service applications can discover and invoke the services it deploys.
In building and using Web Service, the following key technologies and rules are used.
1）XML：A standard method for describing data. It
2）SOAP（Simple Object Access Protocol）：An agreement that represents the exchange of information. It
3）WSDL（Web Services Description Language）：Web Service description language. It
4）UDDI（Universal Description, Discovery and Integration）：General description, discovery and integration, it is a platform independent, XML based protocol for describing business on the Internet.
1. What is Web Service?
Web Service It’s a network component (a program that can be accessed through the network). It has one or more ports (Port), which are used to receive requests from the client, and return the response requests and responses as a XML based message. But this message follows a specific format (SOAP).
2. How to call Web Service?
It may not be very accurate to say “how to call the operations defined in Web Service”, each Web Service has a description file (WSDL), which describes the following aspects of a Web Service:
1）The port of the service (the port of receiving the SOAP message)
3）The definition of input and output format of operation (define input and output format by XMLSchema)
With the Web Service description file (WSDL), we know how to invoke the operation defined in this Web Service. It
1）Find the operation you want to call through the operation provided by the service;
2）Find the definition of input format (XMLSchema) for this operation, construct a SOAP message according to this input format;
3）Send this SOAP message to the specified port of service;
4）Ready to receive a SOAP response from the Web Service server.
3. Web ServiceServer?
A Web Service server is essentially the same as a Web server. It mainly does the following things:
1）Monitor the network port (monitor service port)
2）Receiving client requests (receiving SOAP requests)
3）Parsing client requests (parsing SOAP messages, converting SOAP messages to data objects)
4）Invoke the business logic (call Web Service to implement the specific operation of the class. The parameter is the data object transformed from the SOAP message).
5）Generate response (convert the return value to SOAP message)
6）Return the response (return to the SOAP response)
4. What is WSDL?
1）WSDL Refers to the network service description language
2）WSDL Use XML to write
3）WSDL It’s a XML document
4）WSDL Used to describe network service
5）WSDL Can also be used to locate network services
6）WSDL It’s not the W3C standard
WSDLWeb Services can be described as a network service description language. It is a document written in XML, which can describe a Web service. It can specify the location of the service and the operation (or method) provided by the service. It
WSDL The document is just a simple XML document, which contains a series of definitions describing a web service.
WSDL Document structure (WSDL documents are used to describe a web service by these main elements):
The main structure of a WSDL document is like this:
definition of types……..
definition of a message….
definition of a port…….
definition of a binding….
PS：In fact, the above structure can be viewed by using a browser to open a specific WebService. WSDL documents can contain other elements, such as extension elements, and a service element, which can take several web services.The definition is combined in a single WSDL document.
<portType> The element is the most important WSDL element. It can describe a web service, executes operation, and related messages. <, portType>, and elements can be compared to a function library (or module, or one) in the traditional programming language.A class).
<message> The element defines a data element for an operation. Each message is made up of one or more components. These components can be compared to the parameters of a function call in the traditional programming language.
<types> The element defines the data type used by web service. In order to maximize platform neutrality, WSDL uses XML Schema syntax to define data types.
<binding> The element defines the message format and protocol details for each port.
This is a simplified fragment of a WSDL document:
<part name=”term” type=”xs:string”/>
<part name=”value” type=”xs:string”/>
In this example, < portType> element defines “glossaryTerms” as the name of a port, and defines “getTerm” as the name of an operation. The operation “getTerm” has a name called “getT”The input message of ermRequest and the output message named “getTermResponse”. It
<message> The element can define the components of each message and the associated data types. In contrast to traditional programming, glossaryTerms is a function library, while “getTerm” is an input parameter “getTermRequest” and a return parameter getTe.A function of rmResponse.
In order to wrap the request information of RPC, XML-RPC is introduced, but XML-RPC can only use limited data types and simple data structures. So SOAP (Simple Object Access Protocol) appeared. SOThe main task of AP is to use standard XML to describe the request information of RPC (URI/ class / method / parameter / return value). In theory, SOAP is a XML, you can send it through HTTP, SMTP and so on (copy it to the floppy disk, and send it by courier company).The same SOAP is also cross language.
WSDL(Web Services Description Language)It describes web services and describes how to access Web services. WSDL is used to describe SOAP. In other words, WSDL files tell you everything you need to know about calling SOAP. WSDL is also a segment of XML. Now every language has a great support for WSDLRipe, you can generate your own language client based on the same WSDL file.