How to develop WebService

Source: Internet
Author: User
Tags wsdl

What is a Web service?

A Web service is a network access interface to application functionality that is built using standard Internet technologies.

The Web services that we see today that are deployed on the Internet are HTML Web sites. Where application services, the mechanism for publishing, managing, finding, and retrieving content, are accessed by using standard protocols and data formats: HTTP and HTML. A client application (Web browser) that accepts this standard can interact with the application, performing tasks such as ordering books, sending greeting cards, and reading news. Because standards-based interfaces provide an abstraction mechanism, it does not matter whether the application services are written in Java and whether the browser is written in C + +, or if the application is deployed on a Unix system and the browser is deployed on a Windows system. WEB services have platform-agnostic cross-platform interoperability. Interoperability is the main benefit of implementing Web services. Solutions based on Java and Microsoft Windows are often difficult to integrate, but the Web services layer between the application and the client can greatly eliminate its estrangement.

when publishing webservices, there are usually two methods, code-first and contract-first, which are written by writing program code and then automatically generated by the WSDL file. The latter is to write the WSDL file before generating the server and the client. Most of the online examples are code-first, because they all have a common feature: they're simple.

The disadvantage of first adopting code precedence:

1, if the service has been modified, the WSDL document will also change, in the software development process, one of the first principle is: An interface, once published should be The long-term preservation is unchanged, so that the client based on this interface will not need to be adjusted because of the interface changes once the development is completed.

2. The code first method also violates the topic of language independence in SOAP-based Web services. If the contract is first and the contract is already defined, then the design implementation language can maintain an openness (using c\c++, C #, Java and other languages).    are not subject to language restrictions.

So if the project is relatively small, several interfaces are relatively simple, then using code first is a time-saving method. However, if the project is large and requires multi -party participation, it is better to adopt contract first, set standard, and unify interface. This does not change the interface frequently because one party in the project changes functionality or needs.

How organizations turn to Web services

There are three main ways organizations move to WEB services. As described below:

    1. Create a new Web service from scratch (contract first): The developer creates the functionality of the service and prepares the document to describe the service.
    2. Exposing existing functionality through a Web service (code first): At this point, the functionality of the service is already available. You only need to implement the service description.
    3. Integrate Web services from other vendors or business partners (meet in the middle): In some cases, implementing a new service based on a service is more feasible than building a service from scratch. In these cases, these organizations need to integrate WEB services from other organizations or business partners.

The real use of Web service concepts in the second and third approaches leads us to other Web services and applications that are available to existing applications.

Code first method and contract first method

The code-first (bottom-up) approach enables you to reuse existing investments by exposing your current applications. Credit Card System is an application with proven business value. The competitive pressure is to turn to credit card System to expose the business features (such as card number verification) to a Web service. The implementation class already exists, and what needs to be done is to create the WSDL and expose the class as a Web service.

The contract first (top-down) approach is often also referred to as a "pure method", which is the correct way to build a new Web service from scratch. This method first builds the WSDL (contract) by defining the action message and similar information. Then build the endpoint interface, and finally the implementation class.

SOA (service-oriented architecture)

Service type

    • Entity-based services (e.g. user entity users)
    • Feature-based services (e.g. weather forecasts, mail)
    • Process-based services (process: business processes)
    • Business process (BPM) ERP processes between different business systems
    • Workflows (JBPM) within the same system

How to develop WebService

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.