> Gian, what does a JSON-RPC "router" do?

In .NET (but also in Java) you have to write a lot of boilerplate code
to "route" a JSON-RPC request that comes over HTTP to the
corresponding method call. This code is mostly standard, the only part
that is custom to the application is how to map from a method string
to a method of a .NET class, for example:

method: "MyService.myMethod" =>
MyApplication.MyNamespace.MyService#MyMethod in MyApplication.dll

JsonRpcHandler is a router in the sense that routes JSON-RPC method
calls to the configured method of the configured type, handling all
the data translations.
For a more general example, JsonRpcHandler does what is needed to
translate this:

-----------------------------------------------------------------------------------------------------------------------------------------
GET /rpc HTTP/1.1
Connection: Keep-Alive
User-Agent: Mozilla/5.0 (compatible; Konqueror/3.2; Linux) (KHTML, like Gecko)
Accept: text/html, image/jpeg, image/png, text/*, image/*, */*
Accept-Encoding: x-gzip, x-deflate, gzip, deflate, identity
Accept-Charset: iso-8859-1, utf-8;q=0.5, *;q=0.5
Accept-Language: en
Host: it.wikipedia.org
Content-Type: application/json

{"jsonrpc":"2.0","id":123,"method":"Service.myMethod","params":[1,"hi",{"prop":1}]}
-----------------------------------------------------------------------------------------------------------------------------------------

to this:

var result = new MyApp.MyNamespace.MyService().MyMethod(1, "hi", new
Dto{ Prop = 1 });

and to translate result to this:

------------------------------------------------------------------------------------------------------------------------
HTTP/1.0 200 OK
Date: Mon, 28 Jun 2004 10:47:31 GMT
Server: Apache/1.3.29 (Unix) PHP/4.3.4
X-Powered-By: PHP/4.3.4
Vary: Accept-Encoding,Cookie
Cache-Control: private, s-maxage=0, max-age=0, must-revalidate
Content-Language: it
Content-Type: application/json; charset=utf-8
Age: 7673
Connection: close

{"jsonrpc":"2.0","id":123,result:{"prop":"value"}}
------------------------------------------------------------------------------------------------------------------------

Gian Marco Gherardi
http://gianmarco.gherardi.me



On Thu, Sep 1, 2011 at 6:34 PM, Derrell Lipman
<[email protected]> wrote:
> On Thu, Sep 1, 2011 at 11:10, Gian Marco Gherardi
> <[email protected]> wrote:
>>
>> I want to let you know that i've developed a JSON-RPC2 router for
>> .NET.
>
> ...
>>
>> PS: Given that Qx conforms to JSON-RPC 2.0 specs for RPC layer, i
>> don't consider this thread off-topic.
>
> As a reminder, when using the qx.io.remote.Rpc class to issue JSON-RPC 2.0
> requests, you must set the "protocol" property to "2.0" or it will send
> original qooxdoo-style (sometimes called "qx1") requests instead of requests
> conformant with JSON-RPC Version 2.0.
> Gian, what does a JSON-RPC "router" do? I've never heard that term used in
> conjunction with JSON-RPC. Does that mean the generic part of the server,
> that parses the request and passes it off to custom code for each RPC?
> Derrell
>
> ------------------------------------------------------------------------------
> Special Offer -- Download ArcSight Logger for FREE!
> Finally, a world-class log management solution at an even better
> price-free! And you'll get a free "Love Thy Logs" t-shirt when you
> download Logger. Secure your free ArcSight Logger TODAY!
> http://p.sf.net/sfu/arcsisghtdev2dev
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>

------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to