Loading
Spring Support Remote functionality

Java Quick Notes

Refresh Your Java - Before Java Interview

We are Agile, believe in less Documentation - Only Quick notes (Java Interview Questions) of Java/J2ee Read more....


Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet

Go to SiteMap

Q)  How many way Spring Support Remote functionality ?


Ans)

Spring support Remoting several ways, but the following are important ones among them.

Remote Method Invocation (RMI). Through the use of the RmiProxyFactoryBean and the
RmiServiceExporter Spring supports both traditional RMI (with java.rmi.Remote interfaces
and java.rmi.RemoteException) and transparent remoting via RMI invokers.

Spring's HTTP invoker. Spring provides a special remoting strategy which allows for Java
serialization via HTTP, supporting any Java interface (just like the RMI invoker). The
corresponding support classes are HttpInvokerProxyFactoryBean and HttpInvokerServiceExporter.
JAX RPC. Spring provides remoting support for Web Services via JAX-RPC.

RMI:
<bean id="accountService" class="example.AccountServiceImpl">
    <!-- any additional properties, maybe a DAO? -->
</bean>
Next we'll have to expose our service using the RmiServiceExporter:
<bean class="org.springframework.remoting.rmi.RmiServiceExporter">
        <!-- does not necessarily have to be the same name as the bean to be exported -->
        <property name="serviceName" value="AccountService"/>
        <property name="service" ref="accountService"/>
        <property name="serviceInterface" value="example.AccountService"/>
        <!-- defaults to 1099 -->
        <property name="registryPort" value="1199"/>
</bean>


HTTPInvoker :
Server side :
<bean id="httpInvokerProxy" class="org.sprfr.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
  <property name="serviceUrl" value="http://remotehost:8080/AccountService"/>
  <property name="serviceInterface" value="example.AccountService"/>
</bean>

Client:
<property name="httpInvokerRequestExecutor"> <bean class="org.springframework.remoting.
httpinvoker.CommonsHttpInvokerRequestExecutor"/> </property>

Web Services:
Exposing services using JAX-RPC :
Spring has a convenience base class for JAX-RPC servlet endpoint implementations -
ServletEndpointSupport. To expose our AccountService we extend Spring's ServletEndpointSupport
class and implement our business logic here, usually delegating the call to the business layer

public class AccountServiceEndpoint extends ServletEndpointSupport
implements RemoteAccountService {
    private AccountService biz;
}
 

Accessing Web Services
<bean id="yourWebService" class="org.springframework.remoting.jaxrpc.JaxRpcPortProxyFactoryBean">
        <property name="serviceInterface">
            <value>example.RemoteYourService</value>
        </property>
        <property name="wsdlDocumentUrl">
            <value>http://localhost:8080/your/services/yourService?WSDL</value>
        </property>
        <property name="namespaceUri">
            <value>http://localhost:8080/your/services/yourService</value>
        </property>
        <property name="serviceName">
            <value>yourService</value>
        </property>
        <property name="portName">
            <value>yourPort</value>
        </property>
    </bean>



Back to top

------------------------- We hope you got necessary Info On -----------------------------------------

Spring Support Remote functionality


Spring Support Remote functionality

-------------------------------------------------------------------------------------------------------



Face Book
Request for a Mock Interview/Training

Get a PDF

Face Book
Same look (Read) on any device, this is Ads free