Chapter 15. Web Services

Depending on who you talk to, web services are as simple as a set of remote interfaces for an application or as complex as a complete reinvention of the Internet. As is generally the case, the truth lies somewhere in between. As you write enterprise applications, you will find that you often want to expose them to non-Java clients. This chapter details how to take on this task, at least within the context of web services. It examines both simple and complex applications of web services, and gives you a good idea of how to get started in this area of programming.

On the simple end of the spectrum, you can create a web service by providing an application programming interface (API) that is exposed as a set of remote procedure calls (RPC) over the Internet. An example of this is a wholesale business that wishes to provide a set of programmatic interfaces for merchants to verify (in real time) the current inventory of a product, and then order products that are in stock.

At the other end of the spectrum, web services can describe a complete framework for reworking the Internet itself, where HTML and hyperlinks are replaced by a complex system of registries, portable objects, XML-based interfaces to sites with dynamic discovery, or complex and hyper-intelligent models for business-to-business transactions. Obviously this view is a bit extreme, and best avoided for the sake of time, space, and general sanity.

This chapter looks at web services as an RPC mechanism. In particular, it focuses on one of RPC's simplest mechanisms, XML-RPC, and describes the differences between XML-RPC and its more sophisticated cousin, SOAP.