【问题标题】:how to use XMLRPC in C#如何在 C# 中使用 XMLRPC
【发布时间】:2010-11-23 19:49:33
【问题描述】:

我需要从我的 C# 应用程序进行 XMLRPC 调用,但我没有找到任何帮助。当我使用 Ruby 中的 XMLRPC 时,就这么简单:

server = XMLRPC::Client.new2("http://server/api.php")
result = server.call("remote.procedure", [1, [['crit1', 'crit2', 'crit3']]])

有没有类似的 C# 库?

【问题讨论】:

    标签: c# xml-rpc xml-rpc.net


    【解决方案1】:

    使用 xml-rpc.net 库非常简单,这里是你需要做的:

    [XmlRpcUrl("http://url_to_your_server/api.php")]
    public interface ISumAndDiff : IXmlRpcProxy
    {
        [XmlRpcMethod("your.remote.procedure")]
        string testMyClient(string test);
    }
    
    ISumAndDiff proxy = XmlRpcProxyGen.Create<ISumAndDiff>();
    
    string ret = proxy.testMyClient("test");
    

    【讨论】:

    • 我对 xml-rpc.net 只有一个挑剔:它不支持可选参数。
    【解决方案2】:

    看看这个库是否适合你
    https://code.google.com/p/xmlrpcnet/

    【讨论】:

    • 这个库的问题在于它已经过时了,与 Windows Store 或 Phone 应用程序都不兼容,也不支持异步。目前我知道没有任何替代方案。
    • 这个库是开源的,并且随时可用 (code.google.com/p/xmlrpcnet/source/checkout)。我相信你可以将它分叉并移植到这些更新和更新的平台:)
    猜你喜欢
    • 2010-09-09
    • 2011-12-16
    • 2021-12-05
    • 2012-03-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-25
    相关资源
    最近更新 更多