The core of all web services is the ability for code on different machines to interact. There are as many protocols, APIs, and solutions available for this task as there are developers, but remote procedure calls are probably the most traditional approach to the problem. 15.1.1 RPC BasicsA brief discussion of the remote procedure call (RPC) is in order. Object-oriented developers work with code such as that shown here: Window myWindow = new Window( ); myWindow.setTitle("Hello"); You'll notice that the details of how to actually set a window title are completely hidden from the developer. Not just obvious details (such as the code for drawing the graphics) are hidden here, but runtime details (such as how the methods are bound to the object or how memory is allocated) are abstracted away. The details are typically a combination of runtime code, compilers, linkers, and other tools.
The basic idea behind RPC is that a developer ought to be able to work with a remote object as naturally as with a local object: Window myWindow = RemoteWindowServer.getWindow( ); myWindow.setTitle("Hello"); In this example, a window is created and runs on a remote server, and all the standard interfaces that one would expect are now available, except now the actual drawing of the window occurs on the remote server. The details of how the text string "Hello" is sent across the network are abstracted away from the developer. 15.1.2 Java and RPCRemote Method Invocation (RMI) is the built-in Java implementation of an RPC mechanism. RMI works well, but it requires some setup and configuration, and, perhaps most importantly, it's a very Java-specific way of performing RPC. The code that you write and expose as RMI services is readily accessible only from another Java application. Recently, CORBA was positioned as the next big thing in RPC mechanisms, but it suffered from its complexity. In particular, a strong emphasis was placed on making CORBA a superset of several different languages, including C++ and other languages such as Pascal. CORBA bindings are included in the standard JDK distribution, but they have never seen the kind of popularity that its supporters would like. |