Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Tuscany supports JSON-RPC as a protcol for use with SCA services by using the <binding.jsonrpc> SCDL extensionelement in your Application composite. This enables remote web browser clients to easily make RPC style calls to server-side SCA components.The complete timeline of available and future plans is given in the Tuscany Web 2.0 Roadmap

User Stories

  • A client application invoke a remote SCA Service using JSON-RPC and the invocation return business objects in JSON format. (tick)
    • e.g. Retrieve catalog items
  • A SCA component can define a reference to a remote SCA Service and use JSON-RPC for the invocation. (tick)
    • e.g. A catalog aggregator invoke various catalog services using JSON-RPC and aggregate the returned items into a single response
  • A client application invoke a SCA Service using JSON-RPC and the invocation returns a business exception. (tick)
    • e.g. Empty catalog throws a Busines Exception. Business Exception should properly propagate and display nicely to client.
  • A client application invoke a SCA Service using JSON-RPC and the invocation returns a runtime exception. (tick)
    • e.g. Try to retrieve catalog items from a catalog service that is un-available. Runtime exception properly propagate and display nicely to client.
  • A client application needs to access a service exposed trough JSON-RPC binding that requires authentication.
    • e.g. make sure if nobody can get to the catalog if it's not authenticated

Using the Tuscany JSON-RPC binding

You could use this binding without any configuration, or by providing a specific service URI.
To include it on a SCA service or Reference, choose one of the SCDL examples below :

Code Block

<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
           xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
        <binding   ...

	   <tuscany:binding.jsonrpc/>
Code Block
<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
           xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
           ...

   <binding.jsonrpc uri="http://localhost:8080/store/catalog"/>

...

There are two samples showing using <binding.jsonrpc>, one which uses the Dojo Toolkit on the client, and another which uses the Tuscany scaDomain.js script. The samples are helloworld-dojo and helloworld-jsonrpc.

...

Info
titleDifferences between <binding.jsonrpc> and <binding.dwr>

The current Tuscany SCA runtime supports <binding.jsonrpc> and <binding.dwr> 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
  • <binding.jsonrpc> uses the standard JSON-RPC protocol, <binding.dwr> uses a proprietry protocol using DWR

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

...

titleChanges since 0.90 release

...

.