Announcement Announcement Module
Collapse
No announcement yet.
Accessing spring-deployed RMI service with a non-spring client Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Accessing spring-deployed RMI service with a non-spring client

    Hi,

    The server has deployed an RMI-based service using spring remoting.

    Is there a specific way for a non-spring client to call these services? Does the client have to look up a specific spring interface ?

    Thanks.

  • #2
    This depends on whether the server exposes a traditional RMI service (implementing the Remote interface, declaring RemoteException) or a Spring "RMI Invoker" service (any business interface as service interface).

    In the traditional RMI case, simply perform a standard RMI Naming lookup on the client side. There are no Spring specifics involved then.

    Code:
    MyService proxy = (MyService) Naming.lookup("rmi://localhost:1099/myService");
    In the RMI Invoker case, you need to build a Spring-specific RMI proxy like as follows:

    Code:
    RmiClientInterceptor rmiClient = new RmiClientInterceptor();
    rmiClient.setServiceUrl("rmi://localhost:1099/myService");
    MyService proxy = (MyService) ProxyFactory.getProxy(MyService.class, rmiClient);
    which involves the Spring-specific AOP ProxyFactory and RmiClientInterceptor classes. This is the equivalent of a RmiProxyFactoryBean definition in a Spring application context.

    Juergen

    Comment


    • #3
      HTTP-based remoting

      Hi,

      If I have deployed the service via HTTP, would the code from a non-spring client be similar along the lines of the following:

      --//--

      HttpInvokerClientInterceptor remoteClient = new HttpInvokerClientInterceptor();
      remoteClient.setServiceUrl(serviceUrl);
      remoteService = (MyRemoteService) ProxyFactory.getProxy(MyRemoteService.class, remoteClient);

      --//--

      This keeps telling me that it can't find the service at the URL. I'm pretty sure that the service is deployed properly. Any ideas ?

      Thanks

      Comment

      Working...
      X