|
|||||||
|
Comparing RPC implementations: CORBA, Hessian, Burlap and SOAP.Published 5-Oct-2004 Summary: This little test project compares convenience of use and performance of 4 RPC implementations: CORBA (that comes with j2sdk1.4.2_05), Hessian, Burlap and SOAP ( Axis 1.2 RC1). Source code: Download it here. This little test has been inspired by this post at TheServerSide.com . I decided to compare several RPC methods of communication between client and server. Even I did not use CORBA for awhile I quickly recovered from memory and CORBA spec(yes, it is readable and useful!) what needs to be in IDL. 1 module KGIRiaTest I would say that IDL looks refreshingly human friendly and it is kind of obvious what is defined there even for somebody, who never saw IDLs before. But lets describe what is there anyway, the IDL defines:
Now lets run idlj 7 <target name="idlc"> 8 <mkdir dir="build/java_generated"/> 9 <exec executable="idlj"> 10 <arg line="-emitAll -fall -td build/java_generated metadata/ria.idl"/> 11 </exec> 12 </target> 13 and generate whole bunch of Java classes
As we may see this is very simple process. Now lets create implementation of for our server. It is not difficult too: we just extend RiaServerPOA class that was conveniently prepared for us by idlj. 20 public class RiaServerImpl extends RiaServerPOA{ In the implementation we will simply return array of 13 Users, which we prepare upon class initialization. Then we start naming service ( do not forget su - root on Unix because naming works on port 900 by default )
and start our CORBA service. Now we will write simple client CorbaImplTest, which will retrieve out Business Interface (RiaServerOperations) That is it! As we can see dealing with CORBA is not that bad as painted by SOAP evangelists. 17 public class RiaServerBurlap extends BurlapServlet implements RiaServerOperations{ 18 19 RiaServerImpl impl = new RiaServerImpl(); 20 21 public UserVO getUser(String login) { 22 return impl.getUser( login ); 23 } 24 25 public UserVO[] listUsers() { 26 return impl.listUsers(); 27 } 28 29 } 30 As we see we use the same implementation class as we use for CORBA server: it is POJO. Now lets configure web.xml and deploy our little web application on server:
17 public static void main(String[] args) {
18 try{
19 String url = "http://localhost:8080/protocol_compare/RiaServerBurlap";
20 BurlapProxyFactory factory = new BurlapProxyFactory();
21 RiaServerOperations riaServerOperations = (RiaServerOperations) factory.create(RiaServerOperations.class, url);
22 TestingTimer.timeListUsers( "Burlap", riaServerOperations );
23 }catch( Exception e ){
24 e.printStackTrace();
25 }
26
27 }
And finally lets try exposing the same POJO as SOAP with Axis. IMO it is less convenient environment to deal with: I cheated and manually inserted service description from service wsdd file into server-config.wsdd . Development steps with Axis are almost the same as with CORBA development, but they are not that polished yet and a bit less intuitive. Although once figured out and placed into build.xml file it works OK. After deploying service we will use wsdl2java to generate SOAP client:
And now we can run all our tests side by side: This little test does not pretend to be a complete comparison of technologies. It is just a little exercise, feel free to repeat it and draw your conclusion.
Happy coding! |
||||||
| © 2001 - 2006 Konstantin Ignatyev | |||||||