如何在 C# 中使用 XMLRPC

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1348503/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 15:28:45  来源:igfitidea点击:

how to use XMLRPC in C#

c#xml-rpcxml-rpc.net

提问by

I need to make XMLRPC calls from my C# application and I failed to find any help with that. When I used XMLRPC from Ruby, it's that simple:

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

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

is there any similar library for C#?

C# 有没有类似的库?

回答by Joel Martinez

See if this library works for you
https://code.google.com/p/xmlrpcnet/

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

回答by Joel Martinez

It's very simple to use the xml-rpc.net library, here is what you need to do:

使用 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");