Results 1 to 3 of 3

Thread: Accessing spring-deployed RMI service with a non-spring client

  1. #1
    Join Date
    Apr 2007
    Posts
    5

    Default 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. #2
    Join Date
    Aug 2004
    Location
    Linz, Austria
    Posts
    391

    Default

    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

  3. #3
    Join Date
    Apr 2007
    Posts
    5

    Default 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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •