static void Main() { // // Demonstration of client calls to a JSON-RPC service. // JsonRpcClient client = new JsonRpcClient(); client.Url = "http://www.raboof.com/projects/jayrock/demo.ashx"; Console.WriteLine(client.Invoke("system.about")); Console.WriteLine(client.Invoke("system.version")); Console.WriteLine(string.Join(Environment.NewLine, (string[]) (new ArrayList((ICollection) client.Invoke("system.listMethods"))).ToArray(typeof(string)))); Console.WriteLine(client.Invoke("now")); Console.WriteLine(((DateTime)client.Invoke(typeof(DateTime), "now")).ToString("r")); Console.WriteLine(client.InvokeVargs("sum", 123, 456)); Console.WriteLine(client.Invoke("sum", new JsonObject { { "a", 123 }, { "b", 456 } })); Console.WriteLine(client.InvokeVargs("total", new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 })); client.CookieContainer = new CookieContainer(); Console.WriteLine(client.Invoke("counter")); Console.WriteLine(client.Invoke("counter")); }
public void Connect(string url = "http://localhost:8080/") { client = new JsonRpcClient(); client.Url = url; }