So far, all of the examples we have looked at have assumed that all the components in your application are running on the same machine, and indeed, in the same JVM. In many cases, this architecture is preferable to one where components are distributed across many different machines. In some cases, however, running an application on a single machine does not sufficiently meet the requirements of the application, and you need component distribution to meet these requirements.
In this chapter, we discuss four of the five remote component architectures Spring provides, looking at how you can use Spring's support classes to create, expose, and access remote services using each different architecture. Although Spring provides five different remoting architectures, shown later in Table 16-1, the Hessian and Burlap classes are identical, so we just focus on Hessian rather than repeat the same content for Burlap.
In particular, this chapter focuses on the following:
Remoting with RMI: In this section, you see how to develop remote services using RMI and Spring. You learn how to expose any POJO service object over RMI using Spring's RMI service exporter. This section also demonstrates the creation and usage of CORBA services using Spring and JNDI.
Spring and XML web services: No remoting architecture is complete without support for XML web services and in this section, you learn to build JAXRPC web services using Spring and Apache Axis.
The Spring HTTP Invoker architecture: Spring comes complete with its own built-in remoting architecture that uses standard Java serialization over HTTP. This section shows you how to expose your POJO services using HTTP Invoker and also how to secure your services using HTTP Basic authentication.
Caucho Hessian integration: In addition to support for the standard RMI and JAXRPC remoting architectures plus its own native architecture, Spring also integrates with the Caucho projects, Hessian and Burlap. In this section, you see how to use the HTTP-based Hessian alongside Spring as the remoting architecture for your applications. This section also shows you how to use HTTP Basic authentication with Hessian to provide a level of security for your applications.
For this chapter, we assume that you have a basic understanding of both RMI and JAXRPC. If you are not familiar with the basics of either of these, we suggest that you read the RMI tutorial at http://java.sun.com/docs/books/tutorial/rmi/ and the Java web services tutorial at http://java.sun.com/webservices/docs/1.3/tutorial/doc/index.html.