Under what circumstances should we use web service?

Source: Internet
Author: User
Tags soap client

A one-month meal scheduleProgramToday, I started to work hard. I learned about WebService for a long time and forgot about it. I collected some information from the Internet to help me improve my skills.

 

Now I will list three cases. In these three cases, you will find that using Web Service will bring great benefits. Afterwards, I will cite some situations where web services should not be used.

Communication across firewalls


If your applications have thousands of users and all of them are distributed across the world, communication between the client and the server will be a tricky problem. That's because the client and server usually have
There is a firewall or proxy server. In this case, it is not that simple to use DCOM. In addition, you usually do not want to publish your client program to such a large number of users.
Therefore, you finally chose to use a browser as the client, write a bunch of ASP pages, and expose the middle layer of the application to the end user. What are the results? If you are lucky, it's just that development is more difficult and you are not lucky.
Then, an application cannot be maintained at all.

Imagine how you should add a new page in your application: you must first establish a user interface (Web
Page. This is not enough. You need to create at least one ASP page to accept user input, call the intermediate layer component, and
If it is formatted as HTML, the "result page" will be sent back to the browser. If the clientCodeIt is no longer so dependent on HTML forms. Isn't client programming much easier? Also, create an ASP page
Can this step be omitted?

Of course. If your intermediate layer component is Web
Service, you can directly call the middle layer components from the user interface, thus saving the step of creating an ASP page. To call Web
Service, you can directly use Microsoft soap
Toolkit or. You can also use a self-developed soap client such as. Net to connect it to your application. This not only shortens the Development Week
It can also reduce the complexity of the code and enhance the maintainability of the entire application. At the same time, your application no longer needs to jump to the corresponding "result page" every time you call the middle layer components.


In my experience, the Web
The service structure can easily save 20% of the development time spent on User Interface Programming. Another benefit of doing so is that you will get
Service, which can be reused in application integration or other scenarios. Finally
Service exposes the logic and data of your applications, and allows customers on other platforms to reuse your applications.

Application Integration


Enterprise Application developers know that enterprises often need to integrate various programs written in different languages on different platforms, this integration will take a lot of development effort. Your application
It is often necessary to obtain data from a program running on an old IBM host;
Or send the data to the host or Unix application. Even on the same platform, various software products produced by different software vendors often need to be integrated. Web
Service, applications can use standard methods to expose functions and data for other applications.

For example, you have an order logon program used to log on to
New orders from the user, including the customer information, delivery address, quantity, price and payment method. At the same time, you also have an order execution program for the management of actual goods delivery. These two programs are from different software
Vendor. After a new order comes in, the Order login program needs to notify the order execution program to send the goods. By adding a web layer to the order execution Program
Service, the order execution program can expose the "addorder" function. In this way, every time a new order arrives, the Order login program can call this function to send the goods. Connect
Web service integration application

B2B Integration

Using Web service to integrate applications can make your company's internal business processing more automated. But what happens when the transaction crosses your suppliers and customers and breaks the company line? Cross-company business transaction integration is usually called B2B integration.


Web Service is the key to successful B2B integration. Web
Service, your company can expose key business applications to specified suppliers and customers. For example, if your electronic order system and electronic invoice system are exposed, your customers can
Send you a purchase order, and your supplier can electronic the raw material purchase invoice to you. Of course, this is not a new concept: electronic document exchange (EDI) is just like this. Web
The main difference between service and EDI is that the implementation of Web Service is much simpler than EDI, and
Services run on the Internet and can be easily implemented anywhere in the world, resulting in relatively low operating costs. However, web
Unlike EDI, service is a complete solution for document exchange or B2B integration. Web
Service is only a key part of B2B integration, and many other parts are required to complete this integration.

Web
The biggest benefit of implementing B2B integration through service is that it can easily implement interoperability. As long as you expose your business logic to the Web
Service, you can allow any specified partner to easily call your business logic, regardless of the platform on which their system runs and what development language is used. This greatly reduces the amount of data spent on
The time and cost of B2B integration. This low cost makes B2B integration possible for many small and medium-sized enterprises that could not bear the original EDI investment costs.

Software reuse


Software reuse is a big topic, with many forms and degrees. The most basic form isSource codeModule or class-Level Reuse. Another form is binary Component reuse. Currently, like a table control or
Reusable Software components such as user interface controls have a large share in the market. However, the reuse of such software has a very serious limitation: reuse is limited to code, and data cannot be reused. The reason is that you can
It is easy to publish components or even source code, but it is not so easy to publish data unless the data is static data that will not change frequently.

Web
Service allows you to reuse the data after the Code while reusing the code. Use Web
Service, you no longer have to buy and install software components from a third party as before, and then call these components from your application. You only need to directly call the remote web
Service. For example, if you want to confirm the email address entered by the user in your application, you only need to send the address directly to the corresponding web
Service, this web service will help you check the street address, city, province, province, zip code and other information, to confirm that this address is indeed in the corresponding zip code area. Web
Service
The provider can pay for the service on time or on the number of times it uses it. This kind of service needs to be implemented through Component Reuse, because in this case, you must download and install services that include street addresses, cities, and provinces.
The database of zone and zip code, and the database cannot be updated in real time.

Another case of software reuse is to integrate the functions of several applications. For example, you
To create a portal application on a LAN, users can query their FedEx packages, view the stock market, manage their schedules, and buy movie tickets online. Now WEB
Many application vendors have implemented these features in their applications. Once they pass these functions through the Web Service
Once exposed, you can easily integrate all these functions into your portal to provide users with a unified and friendly interface.

Web
Service to integrate functions of various applications and provide users with a unified interface.
Service, which extends the current component-based application structure to a hybrid structure of components and Web services. You can also use third-party web
Service. You can also use the Web Service
Provide to others. In all these cases, you can reuse the data behind the code and code. In short, Web Service is a very powerful form of software reuse.

When should I use web service?


A complete introduction to Web service should also include when web service should not be used. After the previous introduction, we know the Web Service
It is most useful for web-based Interoperability or remote calls. However, in many cases, Web Services cannot bring you any benefits at all.

Standalone application


At present, we still have many desktop applications for commercial use and personal use. Some of them only need to communicate with other programs running on the local machine. In this case, we 'd better not use the web
Service
You only need to use the local API. Com is very suitable for working in this case because it is small and fast. The same is true for the server software running on one server: it is best to directly use com or other
To call applications. Of course, Web services can also be used in these situations, but that will not only consume too much, but also will not bring you any benefits.

Homogeneous applications on LAN


In many applications, all your programs are developed using VB or Vc, all of which use Com on the Windows platform and run on the same LAN. For example, you have two server applications
Communicate with each other, or you have a Win32 or winform client program to connect to another server program on the LAN. Using DCOM in these programs is more effective than soap/HTTP.
. Similarly, if you have one. Net program to connect to another on the LAN. Net program, then you should use. Net remoting. Interestingly, in. Net
In remoting, you can also specify to use soap/HTTP for Web Service
Call. However, it is better to call RPC directly through TCP, which will be much more effective. In short, as long as you look at the application structure, there are other methods than Web Service
If it is more effective and feasible, do not use web services.

Summary

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 Services will reduce application performance without any benefits. For example, a homogeneous application running on a machine or a LAN should not communicate with Web Services.

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.