Astn/JSON-RPC.NET

Test Client example doesn't match current version

Closed this issue · 3 comments

I've been digging through the code and test examples to attempt to discern implementing a client and the test code for client doesn't seem to be in line with your latest release.

I'm trying to use a good working JSON-RPC client for an externally hosted server that I do not control. RPC calls would not be internal to the program, so I'm not sure how to instantiate a client to make an external request with your framework.

Astn commented

What transport protocol does this RPC server use? Are you looking for some http client example?

I’m accessing a Fortinet Analytics Device using JSON-RPC over https. I was able to make a test script in Python using generic dictionaries to define the JSON-RPC structure and simulate a success call for login, system status, and logout. It’s just a basic JSON-RPC example using an HTTPS request.

I’m trying to create an HTTP Client in .Net that will complete the request and control the outer RPC structure so I can just deal with the encapsulated data. Your framework seems to have the tools necessary to do this, but I can’t seem to figure it out by digging through the code, and your JsonRpc.Client folder appears to be from 4 years ago where the InProcessJsonClient.cs is now depreciated.

Does your framework only work with in house JSON-RPC calls?

Astn commented

This framework is for hosting json-rpc services. It is not currently one of our objectives to provide Json-Rpc client libraries. Though it might make sense to do so for HTTP as that is so common.

The client code you found ( https://github.com/Astn/JSON-RPC.NET/blob/master/AustinHarris.JsonRpc.Client/client.cs ) should still be near what you would want to act as a client to any json-rpc service. It is also what was used to test the Asp.net handler.
The biggest issue I see with that client is that it does not take advantage of Async and Await and the newer functions available in HttpClient. It is also biased to returning an Observable, and you might find it more convenient to deal with Tasks.