I recently published a framework that may help you. Please check https://sites.google.com/site/javacornproject/corn-gate project page to get detailed information.
Below is a sample code to define and implement a service in Gate:
@GateService(name="HelloWorldService",componentTarget="net.sf.corn.gate.sample.service.HelloWorldServiceImpl")
public interface IHelloWorldService {
public String sayHelloWorld();
}
public class HelloWorldServiceImpl {
public String sayHelloWorld(){
return "Hello World";
}
}
Below are the couple of samples to access to HelloWorldService from various clients :
1- JavaScript Client AJAX Call:
var jsonrq = new JsonRpcRequest("http://localhost:8888/jsonrpc");
var response = jsonrq.send("358", "HelloWorldService", "sayHelloWorld");
2-Java Remote Client:
JsonRpcClient client= new JsonRpcClient(new URI("http://localhost/jsonrpc"));
JsonRpcResponse resp= client.callAService("HelloWorldService","sayHelloWorld");
3-REST client (Browser)
http://localhost:8888/jsonrpc/HelloWorldService/sayHelloWorld
I hope this helps.