You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

Unable to render {include} The included page could not be found.
Unable to render {include} The included page could not be found.

<binding.jsonrpc>

The Tuscany Java SCA runtime supports JSON-RPC as a protcol for use with SCA services by using the <binding.jsonrpc> SCDL extension. Using <binding.jsonrpc> enables remote browser clients to easily make RPC style requests to server-side SCA components.

This binding has no attributes or elements so to include it on a service simply requires the following SCDL:

   <binding.jsonrpc/>

The most common use of JSON-RPC is web browser clients making RPC style calls to server-side SCA services. To facilitate this Apache Tuscany provides a client-side script to initialize the SCA environement within the browser client.

    <script type="text/javascript" src="SCA/SCADomain/scaDomain.js" />

Using SCA JSON-RPC services with Dojo

Apache Tuscany JSON-RPC services provide built-in support for Dojo RPC. The Dojo toolkit is a popular framework for writing Ajax/Web 2.0 style browser client applications. Tuscany SCA services which use <binding.jsonrpc> will by default support the Simple Method Description (SMD) protocol. SMD is similar to ?wsdl for Web services, entering a service endpoint appended with ?smd will return a SMD descriptor for the service.

Using Tuscany SCA services with Dojo can therefore be as simple as the following:

  var myService = new dojo.rpc.JsonService("SCA/SCADomain/MyService?smd");

Some examples:

Differences between <binding.jsonrpc> and <binding.ajax>

The current Tuscany SCA runtime supports <binding.jsonrpc> and <binding.ajax> which provide similar functionality. The differences are:

  • <binding.jsonrpc> supports the SMD protocol enabling easy use with Dojo, <binding.ajax> does not support SMD
  • <binding.ajax> supports SCA references and using COMET style asynchronous operation, <binding.jsonrpc> does not

These differences should be resolved by the Tuscany SCA 1.0 release.

Changes since 0.90 release

The Tuscany JSON-RPC and Ajax binding's have had significant functional and useability changes since the 0.90 release. It is recomended that if possible the latest code is used (the description on this page is based on the latest code).

  • No labels