JSON-RPC Client Example for ASP.NET

May 30, 2014 at 7:28 AM
Edited May 30, 2014 at 7:30 AM
I have implemented the server side usg this tuto https://jsonrpc2.codeplex.com/ , but I can't use the JsonRpcClient Class to implement the client side, I found this class in the source code on GitHub, but I didn't find it in the API AustinHarris.JsonRpc . Thank you for some help
Coordinator
Jun 3, 2014 at 6:46 AM
Edited Jun 3, 2014 at 6:47 AM
The c# client in the source that works over HTTP is not currently supported, but can be a good example to get you started.

If your looking to use it from Javascript, there is a JQuery plugin. http://plugins.jquery.com/tag/json-rpc/
If you want to use from C# you may need to write your own client, or ammed the code on GitHub to work for you. If you do get it working, feel free to put in a pull request.

Maybe someone else here has a client they can recommend?.
Jun 3, 2014 at 9:47 AM
I found the Jayrock API, this is their official site http://jayrock.berlios.de/ ,
and there is the Jayrock pachage for c# https://code.google.com/p/jayrock/downloads/list

this is the implementation of the Class JsonRpcClient for the Client side https://code.google.com/p/jayrock/source/browse/src/Jayrock.Sandbox/JsonRpcClient.cs?r=0df7b70e7394827f02ff2c9d2e685aa0fa8fafa2


and this is an example for Client side implementation https://code.google.com/p/jayrock/issues/attachmentText?id=36&aid=360001000&name=Program.cs&token=ABZ6GAcsMN74lKc4zfh-YlXiCCoK_tVcvw%3A1401788131158

that works fine for me , I was afraid about issues of incompatibilities when using two APIs in the same application AustinHarris.JsonRpc for Server Side and Jayrock for Client side, but til now it seems good.

But I have a remark , in the Jayrock API they define a type for JSON Objects that is called "JsonObject" , in the AustinHarris.JsonRpc API there is no equivalent type , I have to Serialize my JSON Objects and send them as strings , and deserialize them in the other side ( server ) to use them , and this is a hard task to do.
Coordinator
Jun 25, 2014 at 7:15 AM
Edited Jun 25, 2014 at 7:16 AM
The equivalent type is JObject from the newtonsoft namespace. See this example:
using Newtonsoft.Json.Linq;
        [JsonRpcMethod]
        private JObject testArbitraryJObject(JObject input)
        {
            return input;
        }