Search code examples
c#clientxml-rpc

C# XML RPC Client


I'm working on an application that will need to communicate with an XMLRPC server. Currently I'm using CookComputing's library from xml-rpc.net

Not exactly sure what I'm doing wrong, fairly new to C#. I'm trying to invoke the RPC call "main.tx" which when recieived by the server should enable the transmit mode/function of the server software I want to communicate with.

using CookComputing.XmlRpc;

namespace xmlrpc
{
    [XmlRpcUrl("localhost:7362")]
    public interface HelloWorld : IXmlRpcProxy
    {
        [XmlRpcMethod("main.tx")]
        String HelloWorld();
    }


    class Program
    {
        static void Main(string[] args)
        {
            HelloWorld proxy = XmlRpcProxyGen.Create<HelloWorld>();
            Console.WriteLine(proxy.HelloWorld());
            Console.ReadLine();
        }
    }
}

Solution

  • I didn't realize there was more to the exception than I was seeing on the tooltip. I simply had to specify the address with 'http://'

    Everything is working now, below is the solution.

    using CookComputing.XmlRpc;
    
    namespace xmlrpc
    {
        [XmlRpcUrl("http://localhost:7362")]
        public interface FlRPC : IXmlRpcProxy
        {
            [XmlRpcMethod("main.tx")]
            String MainTx();
        }
    
    
        class Program
        {
            static void Main(string[] args)
            {
                FlRPC proxy = XmlRpcProxyGen.Create<FlRPC>();
                Console.WriteLine(proxy.MainTx());
                Console.ReadLine();
            }
        }
    }