> developer > dnu > courses > Web Services page 7
Web Services
April 2003
DeveloperNet University Course
Reader Rating    from ratings rate this article
View an eBook Version of this course - LARGE FILE! Send this page to a friend

Web Services

Now that we have talked about the components that make up a Web Service, we can assign a more accurate and technical definition to Web Services. A web service is a modular web application that provides data and services to other applications in an exchange through the Internet.

A typically used example of a web service would be a Stock Quote application--a web based application sitting in a browser window that displays "real time" stock prices for selected stocks. The application could request stock quote information from a data source and present that information in a graphical way inside the user's browser window. The data is exchanged using SOAP and could possibly be presented in the browser window using an XML technology such as XSL.

The real beauty of this type of web service is that the application may previously have been developed. All you may need to develop is an interface that communicates using SOAP to the application that someone else has developed. The application already responds to requests for stock symbols and provides the information you need. All you have to do is develop the SOAP interface and the presentation to the user. You may not need to worry about how to develop the data store to house the information about the stock symbols the users of your application will request.

The Evolution of Software Development

Figure 2 represents the evolution of software development in the past 20 or so years. Software development began with mainframe computers. You entered code by typing at a terminal or punching out cards and loading the cards into the mainframe card scanner. The functionality and speed of the programs were very limited. Years later, we moved into a client server model. The processing load was distributed more between the client and server. The next stage represents the growth of the Internet and push to put all applications on the Internet. Here, the intent was to allow any computer with a browser access to the application. Now the trend is the provide applications with the capability to provide data to any device or computer without the necessity to build proprietary software for each type of device or computer.

Software development evolution.

Figure 2: Software development evolution.

Today we live in a very connected world. Numerous devices, such as cell phones, PDAs, table PCs, and other types of computers must retrieve and access information through the Internet and present that information to application users. It doesn't take any level of sophistication to realize that you must be able to transmit data to a variety of platforms in order for this to work. If you don't have a standard way of requesting or providing information, you will have to build an application for each type of device that will access your information. This would be expensive and development intensive.

A Web Service is a type of application that provides access to a host of devices and different computers; without the use of proprietary software for each device or computer. Because the method of data exchange is built upon a standard that all devices can communicate with (XML), it allows the application to be universal to each device or computer.

Web Services follow the distributed software architecture. Distributed systems are loosely coupled with the ability to dynamically locate software components on the web. The distributed architecture model allows processing to occur at the server side without the need for a proprietary client to access the service. In a web service, the client can be an ordinary web browser. A web service is created as a compilation of objects that reside on servers. The objects are invoked using requests to perform the services using the SOAP protocol. This makes it so that the client does not need any application specific information in order to run the application. The client makes a request for service and the service is received and serviced without the client application knowing or even being concerned with the location of the service. The web service exists on the Internet to respond to other service requests from other client.

Web Services improve on other distributed software technologies in the following ways:

  • Interoperability with so many devices

  • Agnostic to languages and operating systems

  • Decreased complexity

  • Decreased proprietary nature because many of the components are open standards

  • Separation of data from presentation

  • Ability to easily extend the scope of the application and include new business logic.

Also, Web Services really separates itself from the competition because of its common registry for all web services called UDDI. We'll talk more about UDDI in a little bit.

Web Service Roles

When you develop a Web Service, the application can take on one of three roles. The application will be a service producer, service consumer, or a service registry. Producer

A service producer is an application that provides services to other applications or to end users. It contains the business logic, performs calculations, or retrieves data. It offers these services to any application that requests them. Its purpose is to provide the objects of the application as services so that they may be called upon by consumer applications. To build a producer, you will continue to develop components that perform specific tasks. The component could be a normal Java class. Your Java class becomes a web service because a producer must be able to field SOAP requests and perform the business logic with the requested data. A producer should be able to manipulate XML data. A producer can be implemented as a servlet, EJB, desktop application, applet, or any combination of these applications. Applications that you produce do not only have to provide services for your own consumer applications, but can provide services for producers that use the functionality of your applications.

Consumer

A service consumer is an application that requests the services of a producer. It will discover the services it needs by looking for the service in a registry and invoke the services it needs by making requests to the web service that fit its requirements. A consumer requests the services it needs from the producer and returns the results to the user. A consumer application must be able to parse XML data and present the information to the user. It should be able to understand WSDL, the meta language that describes a Web Service. A consumer application can also be implemented as a servlet, desktop application, applet, or other application type. Your consumer applications request services from a producer application.

Figure 3: Consumer applications request services from a producer applications.

Figure 3 depicts the possible interaction of Web Services. Two Web Services are shown, a simple calculator service and a scientific calculator. Each Web Service has its own consumer applications that request operations from the services. For example, the simple calculator Web Service would provide operations such as add, subtract, multiply, and divide. The consumer application would make requests via SOAP to the application and the result of the operation is returned to the consumer application where it is displayed to the user. The scientific calculator only provides scientific operations such as log, sin, cos, tan, and exponential power functions. The scientific calculator does not have the functions of the simple calculator. In order to perform the simple operations, the scientific calculator must request these operations from the simple calculator. The request is sent via SOAP and returned to the scientific calculator. The scientific calculator then returns the result to the consumer application.

Registry

A registry is the phone book for web services. It is a searchable repository for consumer applications to find the web services they need. Producers publish their services to the registry for consumer applications to be able to discover them. The UDDI is the implentaion of the Web Services registry.

How Does it Fit Together?

Look at the following table to see a review of the web service component and how their function fits into the building of a Web Service application.

Component Function
Java, PHP, C#, C++, or other language
Used to build the producer or consumer applications.
XML
Representation of data that is exchanged in a Web Service transaction.
SOAP
Communication channel for Web Service transactions.
WSDL
Meta language used to describe a Web Service.
UDDI
Registry of Web Services.

Building a Web Service application is as easy as building these components and integrating them together. Most Web Service development tools, such as Novell exteNd will help you generate your SOAP, WSDL, and integrate with a UDDI registry.

Previous Contents Next
download sample file