What is Web Services?

Source: Internet
Author: User
Abstract: This article introduces the origin and basic principles of Web Services, and analyzes the impact and revolution of Web Services in enterprise applications, this article points out some advantages and disadvantages of web services and how to correctly apply them.

No matter in computer magazines or on the Internet, the most popular topic is "Web Services ". Various platforms compete for each other, release of various new products, and formulation of many new standards, most of which are related to Web Services.

Some of my friends are such people. They always use the latest platform and try the latest technology. They like change and fashion. In their own words, new technologies create a new life! However, when a friend of mine led the developers in one of their departments and spent two months re-designing and implementing their internal management systems using Web Services, however, it is found that the system performance is very poor in actual use. He raised the following question: Is web services still in the experiment and market hyping period and has not entered the practical stage? The simple answer is: Web services is not omnipotent. It has its application scope and advantages and disadvantages.

Origin of Web Services
The great success and continuous development of Web applications have penetrated into all aspects of business and personal life. People only need to use browsers to enjoy a variety of web services, such as online shopping, online transactions, online games, ticket booking, online chat, and dating. At the same time, due to the advantages of web technology (Uniform clients and better maintainability), some traditional applications have been transformed into bsstructures.

However, some problems are gradually exposed in the development. All these web pages are prepared for reading, inputting, and judging. Therefore, various content that reflects the visual effect occupies a large amount of network bandwidth, such as various images, font information, and text typographical styles. However, some truly valuable information is deeply buried in the display information, which is difficult to be used by other applications and Program Used. More importantly, there is a lack of interaction and communication mechanisms between various web services.

Is communication between programs very important? For example.

Assume that you often go abroad for business trips. After you return home, the first thing you do is reimbursement. Your company has such financial regulations that all reimbursement payments are settled based on the Foreign Exchange price on the day of reimbursement. Therefore, when you fill out the reimbursement form, you must first fill in the consumption of each item in each country, then go online to find out the foreign exchange price for the day, and fill in the reimbursement form. You may not need to do the rest of the work. The tool for filling in your reimbursement form will automatically convert and count.

Do you think there is anything wrong? As an IT company employee, there may be a feature that computers should do as much as possible. The query of foreign exchange price can be done automatically by the computer! However, it is not easy to let your program automatically go to the webpage to find the specified foreign exchange price. Because these web pages are for people to read, and the response speed of human eyes and brain is fast, they can quickly locate what you want from the whole page of information, and no matter how the web page changes or the revision, it will not have a big impact. The application is too far away from doing the same thing. Therefore, what we need now is a Web service dedicated to applications.

As applications need to communicate more and more, unified standards and protocols need to be developed. HP is the first company to come up with this idea. They have developed "e-speak" standards to ensure interaction between applications and claim that they will become the next generation of Internet information interaction standards. Then microsoft realized the bright future of the Plan and launched it. NET strategy; IBM soon released the Web Services Toolkit (wstk) and Web Services Development Environment (wsde), declaring full support for Web Services. At the same time, Oracle has developed its own dynamic services and is integrated with Oracle 8i Release 2. Since then, W3C has developed various standards for Web Services. Sun, after announcing its own web services framework, integrated the web services standards into the J2EE environment, giving web services a widely supported Foundation and platform.

Basic Principles of Web Services
Web Services ensures dynamic connections between programs through a series of standards and protocols. The most basic protocols include SOAP, WSDL, and UDDI.

Soap: the abbreviation of "Simple Object Access Protocol". Soap is the message transmission protocol, which specifies how information is transmitted between Web Services. Simply put, soap stipulates:
1. The format of transmitted information is XML. This enables web services to be implemented in any language on any platform.
2. Format of Remote Object method call. Specifies how to represent the called object and the name and parameter type of the called method.
3. ing between parameter types and XML formats. This is because the called method sometimes needs to pass a complex parameter, for example, a person object. How to use XML to represent an object parameter is also the scope defined by soap.
4. Exception Handling and other related information.

WSDL: the abbreviation of "Web Services Description Language". Its name is as follows. WSDL is the definition language of Web Services. When you implement a certain service (such as the stock query service), you must inform everyone of your service interface to make other programs call it. for example, the service name, the name of the machine where the service is located, the listening port number, the type, number and sequence of passing parameters, and the type of returned results. in this way, other applications can call your service. The WSDL Protocol defines the standards for web services description.

UDDI: the abbreviation of Universal Description, discovery, and integration. To put it simply, UDDI is used to store and find the WSDL description file in a centralized manner and serves as a Directory Server.

For example, the lifecycle of a Web Service is:

Implement a web service to enable it to accept and respond to soap messages (many tools can help implement it now ).

Write a wsdl file to describe this web service. (Currently there are many tools that can automatically generate the WSDL file ).

Publish the WSDL to UDDI.

Other applications (clients) Search your WSDL from UDDI.

Based on your WSDL, the client can write a program (currently many tools can automatically generate a calling program) to call your web services.

Disadvantages of Web Services
Because it is an XML-based application, Web services inevitably inherits some restrictions brought by XML while having all the advantages brought by XML.

Web services usually require a large amount of CPU resources. Because XML data must be processed in multiple steps before it can be used by the system. The first is validate, which checks whether the format complies with the XML specification and whether it complies with the semantic specification according to the application definition (DTD or schema; then we need to parse (PARSE), break down a single element from the XML file, and finally convert it into the Binary Expression required by the application (for example, converts "12" to the binary representation of integer 12 ).

Web services also occupy a large amount of memory resources. A large number of temporary memory objects are generated during XML parsing. Especially when processing DOM objects. These large numbers of temporary objects are a burden on the language and system that automatically recycles memory such as Java. A large number of temporary objects will cause the system to recycle memory at intervals, this reduces system performance. Of course, some web services products (such as axis) now use the sax technology, greatly reducing the memory usage. For more information, see: (http://xml.apache.org/axis/index.html ).

The consumption of network resources is also a limitation of web services applications. Because XML-based data transmission usually has a larger data volume than binary protocols (such as RMI/IIOP. This extra consumption will have a certain impact on applications with tight network resources or frequent network transmission.

In addition to the restrictions imposed by XML, Web Services has some disadvantages:

So far, Web services can also be said to be a stateless service.
Stateless means that it does not save any information of the Client Service caller. This is determined by the nature of Web Services. In essence, Web services must provide data communication standards between applications and dynamically provide services with a large granularity between enterprise applications, therefore, Web services is not suitable for very fine session-based method calls and complex transaction processing.
Someone may disagree with me! Because many web services products (such as wasd) can not only save session information, but also make the service stateful, remote Object handles can be passed in Web Services sessions, allowing clients to manipulate the delivery of remote objects (for details, see: http://www.systinet.com ). In principle, this is not difficult to implement, because in XML data, any data can be transmitted to each other, including sessionid and transactionid. With these IDs, technically speaking, implementing stateful is not complicated. However, this feature lacks standard support, and the WSDL of the current version cannot represent these complex services. Within an enterprise, you can use any of these special functions to define the interaction protocol of the session state, because communication between the service provider and the service caller is under your control; however, to publish these services to the Internet, other applications cannot identify these special features according to standards.

Data Binding also has some shortcomings.
Because all data transmission uses the XML format, there must be a conversion between binary data and XML data. However, not all binary data can be conveniently expressed in XML, and not all Java objects can be expressed in XML. Therefore, semantic loss often occurs during the conversion process.

High technical requirements and long learning curve.
Every web service product has a variety of tools, which can easily generate client programs according to Web Services definitions (such as WSDL files); can integrate general service programs, it is easy to package it into a Web Services Service. Therefore, all web services products claim that their platforms are easy to use, and they do not need to understand XML or WSDL, UDDI, or soap to publish Web Services. In particular, a friend told me that he had published a Web Service in. Net in 15 minutes without knowing anything!
Do not be obsessed with this simplicity. This may be right for simple demos. However, you must understand all aspects of Web Services for serious applications, design the overall structure and solution, and adjust the performance according to the specific application. All of these require a comprehensive understanding of Web Services.

What applications are suitable for Web Services?
Are you discouraged by the many shortcomings of Web Services? In fact, there are already many successful web services applications and more developers joining us, proving that Web Services will surely become the mainstream of the new generation of Web Information Communication. With continuous development, web services will be able to overcome its own weaknesses and be widely used. Currently, Web services are suitable for the following applications:

Wan-and Internet-based applications

To create an Rmi/IIOP application based on the binary protocol on the Internet, the firewall is generally a big problem. The client browser is likely to be behind the ISP firewall, and most firewalls can only allow external HTTP connections, therefore, if you want the client after the ISP firewall to connect to the application ports of RMI/IIOP outside the firewall, you need to change the security policy of the ISP so that the client can connect to other ports except 80. However, if the server running the RMI/IIOP application is in the DMZ after the firewall for security purposes, the connection will become more complex and need to span two firewalls.
Web Services uses the HTTP protocol and transmits XML data in plain text. Therefore, it has good firewall penetration performance.

Heterogeneous platform-based applications

XML is a cross-platform and cross-language data representation method. With the addition of common HTTP and other protocols, Web services are naturally applicable to heterogeneous platform-based applications. If your client contains a variety of platforms, for example, you want your services to be called by Java programs and by VB and COM programs. You have two options: one is to provide corresponding APIs for different platforms, and the other is to provide APIs for different languages. If Web services is provided, all platforms and languages can be called!

Applications requiring strong security features

Many people think that security is a weakness of Web Services. As a matter of fact, Web services can be used in highly secure application environments through continuous improvement and the introduction of various new protocols. In addition, because Web Services uses the HTTP protocol for transmission, it can easily use a variety of mature HTTP-based security technologies.

EAI (Enterprise Application Integration)
This is one of the most promising web services applications. Most enterprises have a variety of internal application systems, which are developed by different software developers during their tenure and therefore run on different platforms and systems, the system development languages are also different. With the improvement of information automation requirements of modern enterprises, interactions and mutual communication between systems are mentioned on the agenda. Therefore, protecting original investment and reusing legacy systems is an important task for many medium and large enterprises.
Because the operating platform of legacy systems is a heterogeneous environment, the cost of enterprise application integration is generally high. However, using web services as a means of application integration will greatly reduce the consumption of integration. Web services features unrelated to the platform and language, as well as development tools in various platforms and environments are powerful tools for enterprise application integration.
In addition, when developing a new application system, you still need to consider integration with other systems. You need to consider calling the functions of other systems and being called by other systems. Using Web services as an interface for system and external communication can maintain loose coupling between new systems and other systems and maintain high scalability.

B2B applications within the industry
Applications within the industry are another direction of Web Services. In an industry, business is very similar, so it is easy to form service standards within the industry, so that all industry enterprises can abide by them together; however, the decision on how to implement services and what system to use lies in the enterprises themselves. For example, settlement services between telecom operators and transfer services between banks can all form industry standards and be published in the form of WSDL. Enterprises can select different platforms for Service implementation.

Improve the Performance of Web Services
To improve the performance of web services applications, you must consider the entire system. Note the following points:

Granularity of Web Services
Selecting the granularity of Web Services is the main means to improve the performance of web services applications. Because the transmission protocol used by Web Services is HTTP or SMTP, these protocols are for stateless connection protocols, and each request must establish a new connection. Therefore, Web services cannot be called in the same way as the database JDBC (ODBC) interface. For example, you can obtain the connection first and then the result set, and then obtain the results in one row ). Web services are suitable for applications with a large granularity. You can obtain all the information in a single call (for example, transfer funds between banks, in one call, all information including the amount and authentication will be transmitted ).

Exercise caution when using the XML interface
The interface between systems can use XML, which increases the flexibility of the system; but do not use XML as the internal interface of the system, because this will not bring any benefits, use binary as the internal interface of the system to avoid parsing and validation of unnecessary XML documents. When processing XML, convert XML into internal objects as soon as possible, XML transfer only increases system overhead.

Maximum possibility of Using Cache
Cache can be used when some information is read-only or remains unchanged for a period of time. Both the Client Cache and the server cache can greatly improve the system performance.

Once Web services are more widely used, various services can be dynamically searched and located, which provides various information interaction methods between different devices, this will greatly change the business operation model and the style of information exchange.

You can use the mature functions of others to provide better services, such as Google. Its search engine can be accessed through Web Services. This means that Google's powerful search functions can be easily embedded in your system, regardless of the platform on which your system runs, make Google's search engine part of your system (see http://www.google.com/apis ). Standing on the shoulders of others, after all, looks farther!

In the face of web services, you can do nothing now, but you must be prepared!

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.