commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Kersten" <Martin.Kers...@Student.Uni-Magdeburg.DE>
Subject Re: Simple RPC Calls
Date Fri, 16 Apr 2004 18:08:58 GMT
> Did you look at the Axis project (http://xml.apache.org/axis) ? Using 
> the Axis API a remote call is as simple as this :
> 
> Service service = new Service();
> Call call = (Call) service.createCall();
> call.setTargetEndpointAddress(new java.net.URL(endpoint));
> call.setOperationName("foo");
> call.invoke(new Object[] {param1, param2, ...});
> 
> I haven't looked at Axis for quite some time, but I wouldn't be 
> surprised if they provide a feature like the proxy you suggested now.

I checked it out but the requirements are not met. It is exellent but
to 'fat'. You know all I need is a simple RPC solution for connecting
applets and a bigger SWT GUI application within a server. 

Using axis does seam to introduce overhead and constraints diffrent
to ordinary Java. Also testing seams a bit difficult. The code
calling a remote service seams to need knowledge about it. But
I am only checking out some examples so I am (currently) not
qualified to say that right now. :)

What I am looking for is as simple and as small as possible. But
I can not believe that my attempt is the first one doing this. So
I am looking for it and If nothing is available to add it somewhere
(sourceforge or anything).


Thanks for help,

Martin (Kersten)

PS: Axis seams not to be able to handling all cases of method
overloading, is that true?
> 
> Emmanuel Bourg
> 
> 
> 
> Martin Kersten wrote:
> 
> > Hi there,
> > 
> >    I am just a student from Germany (Magdeburg) and I have 
> > written a very handy remote procedure call implementation. It 
> > will replace a xml-solution currently connecting a server and
> > an administrational GUI application over here.
> > 
> > It turned out to be very small (about 6KB byte-code on 
> > client side) and it's really simple.
> > 
> > I googled the net before to find anything similar and all I've
> > found was RMI, Hessian and Burlap (+SOAP and CORBA
> > solutions). RMI tend to be overdoing (registery, stub creation 
> > etc) and Hessian and Burlap seam not to allow overloading.
> > 
> > So if I havn't missed any proper solution, I would like to add
> > the little solution to the community reprosity. 
> > 
> > The service interface is similar to Hessian but more 
> > lightweight (in my oppinion). The main scenario is using
> > a Servlet implementing an interface, creating a proxy on
> > the client side and handle invocations by sending it
> > to the servlet and receive the result of the operation.
> > 
> > I currently port the old XML based solution to use 
> > this simple one. It is session aware and works well. 
> > I've also ported the calculator example used by 
> > the jGuru tutorial about RMI: 
> > http://java.sun.com/developer/onlineTraining/rmi/RMI.html
> > 
> > The solution looks similar:
> > 
> > public class CalculatorServlet 
> >     extends SimpleRpcServlet implements Calculator {
> > 
> >     //simple implementations of the methods needed
> >     //to meet the requirements of the Calculator type
> >     //looks like:
> >     public long add(long a, long b) { 
> >      return a + b; 
> >     } 
> > }
> > 
> > The client side looks like:
> > 
> > Calculator calculator=
> >       (Calculator)ProxyFactory.getRemoteProxy(
> >                   Calculator.class,
> >  
> > "http://localhost:8080/simplermi.web/servlet/CalculatorServlet");
> >  System.out.println("10 + 12 = "+calculator.add(10,12));
> > 
> > That's it. Not Stub, no nothing. It works for any serializable 
> > parameter, return value and throwable. Overloading is handled
> > since the parameter types are added to the signature of the 
> > invoked method. So calls to simpleCall(int) and simpleCall(Integer)
> > are handled correctly and not mixed or anything like that.
> > 
> > Really simple and the same can be done using 
> > SocketConnections (didn't pushed it that far but it's the same
> > anyways since the bi-connection is relaiable anyways). 
> > It's simple and fast, which does not be that 
> > kind of a matter when it comes to database operations anyway. ;-)
> > 
> > Another interresting thing is, the solution uses a POST request 
> > and uses a parameter to transmit the invocation informations. 
> > So you can use any existing servlet and add support for RPCs 
> > without modifications since the RPC is only issused when the 
> > parameter is set the way it is required 
> > (this behaviour can also be overridden as well :-)).
> > 
> > The library itself is about 12kb in size currently 
> > (WebService+client side) and the client side requires about 
> > 6KB (4KB when zipped).
> > 
> > If I missed a similar existing implementation, please tell me. I will
> > drop my affords instantly then ;-). Since I didn't found anything, 
> > I think it is a nice add ;)
> > 
> > 
> > Thanks,
> > 
> > Martin (Kersten),
> > Germany,
> > European Union
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message