Refresh Your Java - Before Java Interview
We are Agile, believe in less Documentation - Only Quick notes (Java Interview Questions) of Java/J2ee Read more....
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>
This Portal is intended to put all Java/J2ee related topics at one single place for quick referance, not only Technical , but also the Project Management Related thing such as Development Process methodoogies build process, unit testing etc.,
This Portal has More than 500 Java Interview Questions (also could be Considered as Quick Notes) very neatly separated topic by topic with simple diagrams which makes you easily understandable. Importantly these are from our Realtime expericance.