简体   繁体   中英

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();
        }
    }
}

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();
        }
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM