Basic concepts of Web Service

Source: Internet
Author: User

Http://www.cnblogs.com/frank_xl/archive/2009/02/18/1392844.html

1. Basic concepts of Web Service

What is Web Services? Web Services is a software system (W3C definition) designed to support network-based Interoperability Between machines. It is a group of applications that can be called over the network.ProgramAPI. web services is an application component that uses open protocols for communication. It is independent (self-contained) and can be self-described. It can be discovered through the use of UDDI, functions that can be used by other applications.

The Web Services Platform mainly involves four main elements: XML, SOAP, WSDL, and UDDI. We will briefly introduce them here.

(1) XML: XML is the abbreviation of extensible markup language. XML is a markup language similar to HTML, and XML is used to describe data, XML tags are not pre-defined in XML. You must define your own tags. XML uses Document Type Definitions (DTD) or schema to describe data, after using DTD or schema, XML is a self-described language.
(2) soap: SOAP (Simple Object Access Protocol) Simple Object Access Protocol is a simple protocol for exchanging information in a distributed or distributed environment, is an XML-based protocol. It consists of four parts: Soap encapsulation (envelop), which defines a framework that describes the content of a message, who sent the message, who should accept and process it, and how to process it; the soap Encoding Rules (encoding rules) are used to represent the Data Type instances required by the application; the soap RPC representation (RPC representation) indicates the protocols for remote process calls and responses; soap binding, which uses the underlying protocol to exchange information.
(3) WSDL: Web Services Description Language, which consists of five main elements. types: defines the data type used in the definition of WSDL, that is, XML Schema types; message: defines the input and output parameters of a group of messages; porttype: defines Web service operations; binding: describes the protocol, data format, security, and other attributes of a specific service interface. services: Specifies the URL of a specific service and the provided call interface, which contains a set of port elements. in this way, Web Services implements self-description.

(4) UDDI: the Universal Description discovery and Integration Protocol. UDDI is also a system framework for Web service integration. It includes standard specifications for service description and discovery. The UDDI specification uses many standards of W3C and Internet Engineering Task Organization (IETF) as the basis for its implementation, such as Extended Markup Language (XML), HTTP, and Domain Name Service (DNS) protocols. With it, our web services can be registered to the UDDI Center for customers to find and use.

Web services are generally divided into four categories:

(1) Business-oriented services (business-oriented web service): these services target enterprise application services;

(2) customer-oriented services (consumer-oriented web service): these services target the transformation of B2C websites, for example, we can integrate (CALL) the stock price Query Web Service and air ticket booking Web Service on the Internet in the Personal Financial Management Desktop System, so that the personal financial management application is more automated.

(3) device-oriented services (device-Oriented Web Service): The terminals used for such services are generally handheld devices and household appliances, such as palm, pocketpc, and mobile phones ..

(4) system-oriented service (system-oriented web service): Some traditional system services, such as user permission authentication and system monitoring, for example, all online services of multinational corporations can use the same user permission to authenticate Web Services.

2. Web Service advantages and disadvantages

Let's first understand the shortcomings of the previous platform. the middleware platform (RMI, Jini, CORBA, DCOM, and so on) provides powerful service implementation means. However, these systems have 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. Cross-platform information exchange is not supported. After comparison, we find that the Web Service has the following advantages:

(1) cross-platform: WebService is fully based on XML (Extensible Markup Language), XSD (XMLSCHEMA), and other standards independent of the platform and software vendors;

(2) self-description: Web Service uses the standard WSDL language for self-description, including complete information about the service methods, parameters, types, and return values.

(3) Modularization: Web Service is an application component, which can be developed on any development platform and encapsulated by module.

(4) cross-fire wall: Web Service uses http protocol for communication and can communicate through the firewall.

The disadvantages of web service are also obvious:

(1) low efficiency, not suitable for single application system development.

(2) due to security issues, Web services do not have their own security mechanisms and must implement information security encryption through host programs such as HTTP or IIS.

3. Web Service Usage

So when should we use web service? From the above summary, we can see that using Web Service can bring benefits.

(1) Cross-firewall communication
(2) Application Integration mainly refers to the integration of enterprise application systems.
(3) B2B Integration mainly refers to the integration of e-commerce platforms.
(4) software and data reuse: software reuse is a big topic. There are many reuse forms and the degree of reuse is small. The most basic form isSource codeModule or class-Level Reuse, and binary Component reuse.
WebService is not suitable in some cases.

(1) stand-alone applications

Single-host applications, such as office, can directly call the system windowsapi \ COM for programming to achieve higher functional efficiency.

(2) homogeneous LAN applications
For example, if you use COM + and. Net remoting to communicate in a LAN, it will be more efficient. We do not need to use WebService.

4. Web Service Security Issues

Security issues are the most involved in the development and deployment of Web Services. They mainly prevent leakage of important information, including illegal requests and malicious attacks. Common network security problems web services face.

Web service deployment methods include:

(1) Iis hosting. This is the easiest way to publish a website directly using IIS and publishing methods.

(2) console. It can reside in the console program.

(3) Windows service. Resident in system service.
The most common is that Web Service is published through IIS. The advantage of this method is that it can use all ASP. NET authentication and authorization mechanisms.

The Web Service is located between the presentation layer and the business logic layer. of course, it can directly interact with the database. the simple verification method is to call the method to determine the validity of the request. after verification, we will execute the web method. A simple way to return user data is to use system. web. services. protocols. soapheader class. To pass the client ticket to the server for verification. Next we will implement a simple web service and verification mechanism.

The Web Service deployed through IIS can also be set through IIS website attributes. Including
(1) authentication and property control, which can be integrated with Windows authentication, Domain Server authentication, and. NET Passport authentication. For example.

(2) IP domain name restrictions: only access from specific IP addresses or machines in the domain is allowed to filter illegal requests, such.

(3) Security Communication Settings: users can enable Web server certificates and use SSL to encrypt information transmitted over the network to ensure the security of web services, for example. (The specific implementation can be Baidu)

5. Web Service Development

Web service development is very simple. With Visual Studio 2005 \ 8 clear wizard, select Web service in the new web project ..

Today's development process includes the following four steps:

1) create a class inherited from soapheader to receive messages in the SOAP header.

2). Add a method to the Web service class and client of the server (adding a reference will automatically generate a proxy of the server class ).

3) Add the soapheaderattribute to the methods of the web service class and client proxy service class.

4) You can set the ticket value of the soapheader in the client access proxy class, and the server determines the ticket value in the soapheader of the client. Whether to call the API based on the verification result.

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.