Sep 24th, 2007, 10:44 AM
Accessing HTTP-remoting service from non-spring client
I have a server-side app assembled using spring, which exposes a service via HTTP-based remoting. However, the clients that access the service may not be configured via spring.
I was wondering if there was a way to retrieve and invoke the service interface from a non-spring client.
(i.e if the service was deployed on the following: http://<server>:<port>/remoting/MyService)
What do I need to do on the client-side to invoke this service ?
Sep 24th, 2007, 02:54 PM
for anyone who is interested, here's the solution:
HttpInvokerProxyFactoryBean factory = new HttpInvokerProxyFactoryBean();
factory.setServiceUrl(serviceUrl); // set to url where the service is exposed
remoteService = (MyRemoteService) ProxyFactory.getProxy(MyRemoteService.class, factory);
3 things must be set - the service url, the service interface class, and most important, the request executor (you can use either the simple http invoker (comes with the jdk), or the apache commons invoker (has some more advanced features).