What are Web Services?
Background Information
A Web Service is a software service that is available for public use. Public does not necessarily mean anyone can access the Web Service, nor does it mean that the service is free. Public implies that the Web Service is meant to be accessed from outside of the enterprise or software application in which it is provided. Furthermore, the public interfaces and bindings of the Web Service are openly defined in XML and registered to be shared with anyone accessing the Web Service.
An example
MyWeather.com has a Weather Web Service. The Weather Web Service is provided by MyWeather.com and is hosted on thier machines, but can be used by anyone, from anywhere as long as they have licensed the use of the Weather Web Service. MyWeather.com publicly registers the interfaces and bindings necessary to communicate with the Weather Web Service. This allows users to know a number of things by browsing the registry:
- what kinds of messages the user can send to the Weather Web Service and what kinds of messages the user can expect in return.
- what kinds of data the user can send in messages to the Weather Web Service and what kinds of data the user can expect in return messages from the Weather Web Service.
- how to package the messages the user sends to the Weather Web Service and how the return messages will be packaged.
After determining how the Weather Web Service works by viewing its entry in a Web Services Registry, I can implement the Weather Web Service on my homepage, unit3000-21.org. Let us say that the Weather Web Service has a method called, getTemperature
, that takes a zip code and returns the temperature at that zip code in degrees Fahrenheit. Let us also say that the Weather Web Service speaks a packaging language called, SOAP.
If I wanted to allow users of my homepage to find out the temperature in their zip code area, I would want to implement the Weather Web Service. Through my homepage, I would send the Weather Web Service a package with a message containing data. The data would be a zip code; the message would be to getTemperature
; the package would be packaged according to SOAP. The Weather Web Service would process the data I have sent it and send me a return package with a message containing data. The data would be the temperature in degrees Fahrenheit; the message could be something called getTemperature_Return
; the package would be packaged according to SOAP. It would be my homepage's responsibility to unpackage the package, understand the message and extract the data. Once this is done, I would have the temperature in degrees Fahrenheit for a specific zip code area for my users.
Links
- Designing Web Services with the J2EE¿ 1.4 Platform - this Java Blueprints book provides a good background on Web Services: what it is, what it is useful for and how it can be implemented in Java 2 Enterprise Edition 1.4 using technologies and APIs such as XML, SOAP, WSDL, JAX-RPC, etc.