Summary of 19 Remoting and Web Services using Spring
Currently, Spring supports the following remoting technologies:
RMI:
RmiProxyFactoryBean
RmiServiceExporter
HTTP invoker:
HttpInvokerProxyFactoryBean
HttpInvokerServiceExporter
Hessian:
HessianProxyFactoryBean
HessianServiceExporter
Burlap:
BurlapProxyFactoryBean
BurlapServiceExporter
JAX-RPC:
JAX-WS:
JMS:
JmsInvokerProxyFactoryBean
JmsInvokerServiceExporter
19.5 Web services
Reference doc: http://static.springsource.org/spring-ws/sites/2.0/
Spring provides full support for standard Java web services APIs:
1) Exposing web services using JAX-RPC
2) Accessing web services using JAX-RPC
3) Exposing web services using JAX-WS
4) Accessing web services using JAX-WS
1) Exposing servlet-based web services using JAX-RPC
Base class: ServletEndpointSupport
2) Accessing web services using JAX-RPC
Two ways:
LocalJaxRpcServiceFactoryBean : only return a JAX-RPC service class
JaxRpcPortProxyFactoryBean : full-fledged version, return a proxy to implement our business interface
3) Exposing servlet-based web services using JAX-WS
Base class: SpringBeanAutowiringSupport
3) Exporting standalone web services using JAX-WS
Spring's SimpleJaxWsServiceExporter detects all @WebService annotated beans in the Spring application context, exporting them through the default JAX-WS server
3) Exporting web services using the JAX-WS RI's Spring support
Here is another option implemented in GlassFish project.
4) Accessing web services using JAX-WS
Provide two factory beans to create JAX-WS web service proxies:
LocalJaxWsServiceFactoryBean : only return a JAX-WS service class
JaxWsPortProxyFactoryBean : full-fledged version, return a proxy to implement our business interface
19.6 JMS
The JMS remoting support in the Spring Framework is pretty basic - it sends and receives on the same thread and in the same non-transactional Session, and as such throughput will be very implementation dependent.
19.7 Auto-detection is not implemented for remote interfaces
19.8 Considerations when choosing a technology
19.9 Accessing RESTful services on the Client
The RestTemplate is the core class for client-side access to RESTful services.
RestTemplate's behavior is customized by providing callback methods and configuring the HttpMessageConverter
used to marshal objects into the HTTP request body
and to unmarshal any response back into an object.
Process body:
RestTemplate provides higher level methods that correspond to each of the six main HTTP methods that make invoking many RESTful services a one-liner and enforce REST best practices.
Process head:
RestTemplate also has the exchange() method, which
can be used for arbitrary HTTP method execution based on the HttpEntity class.