> He is also trying to convince me to implement SMD (Service Method
> Descriptors) to further increase the interoperability with Dojo.  This
> one is also up in the air right now, but I hope to widen the
> discussion a bit here and see what others think about it.

The motivation for providing SMD definition is that it provides a standard 
services definition that Dojo can use to auto-create client side methods 
from the services that a jabsorb server provides. We did get Dojo working 
with jabsorb, but right now it works like this, first you create a services 
object:

 var services = new dojox.rpc.Service({
  target:"/jabsorb-1.3/JSON-RPC",
  transport:"POST",
  envelope:"JSON-RPC-1.0?,
  contentType:"application/json",
  services:{
   "hello.sayHello":{ // this is the method that we created in jabsorb
    returns:{"type":"string"},
    parameters:[{"type":"string"}]
   }
  }
 });

And then you can call the method from the service object:
var deferred = services["hello.sayHello"]("Fred");

But if jabsorb could produce SMD definition files from a servlet, we could 
create the services object simply by calling:
 var services = new dojox.rpc.Service("/jabsorb-1.3/SMD"); // dojo will load 
the SMD from the server

Which is obviously much simpler and easier. Creating an SMD definition 
should be very easy to do from the jabsorb side. jabsorb is already creating 
a list of available methods in response to system.listMethods. An SMD 
servlet would simply make the list of methods available in SMD format, which 
would look like:
{
  target:"/jabsorb-1.3/JSON-RPC",
  transport:"POST",
  envelope:"JSON-RPC-1.0?,
  contentType:"application/json",
  services:{
   "object1.method1":{ /* you can add return type, and parameter type 
information here if you want, but it is completely optional, it can just be 
an empty object */  },
   "object1.method2":{   }
  ...
  }
 }

Anyway, hopefully this might be something worth implementing. I think it 
would be easy to do, and I think that having a nice Dojo integration would 
be great win for the jabsorb project.

Thanks,
Kris 


_______________________________________________
Jabsorb-dev mailing list
Jabsorb-dev@lists.jabsorb.org
http://lists.jabsorb.org/mailman/listinfo/jabsorb-dev

Reply via email to