我需要从 .NET 2.0 客户端与 XML-RPC 服务器进行通信。 你能推荐一些图书馆吗?
编辑:尝试过 XML-RPC.Net,我喜欢它生成动态代理的方式,它非常简洁。 不幸的是,一如既往,事情并不那么简单。 我正在访问一个 XML-RPC 服务,该服务使用非正统的技术,在方法的名称中包含对象名称,如下所示:
object1.object2.someMethod(string1)
这意味着我无法使用属性来设置方法的名称,因为它们直到运行。 如果您开始尝试更接近原始调用,XML-RPC.Net 就会开始变得相当混乱。
所以,任何人都知道一个简单明了的 XML-RPC 库,它就可以让我做(伪代码):
x = new xmlrpc(host, port)
x.makeCall("methodName", "arg1");
我在 Codeproject 上看过 Michael 某人的一个东西,但没有单元测试,而且代码看起来非常糟糕。
除非有人有更好的主意,否则我将不得不自己启动一个开源项目!
I need to communicate with an XML-RPC server from a .NET 2.0 client. Can you recommend any libraries?
EDIT: Having tried XML-RPC.Net, I like the way it generates dynamic proxies, it is very neat. Unfortunately, as always, things are not so simple. I am accessing an XML-RPC service which uses the unorthodox technique of having object names in the names of the methods, like so:
object1.object2.someMethod(string1)
This means I can't use the attributes to set the names of my methods, as they are not known until run-time. If you start trying to get closer to the raw calls, XML-RPC.Net starts to get pretty messy.
So, anyone know of a simple and straightforward XML-RPC library that'll just let me do (pseudocode):
x = new xmlrpc(host, port)
x.makeCall("methodName", "arg1");
I had a look at a thing by Michael somebody on Codeproject, but there are no unit tests and the code looks pretty dire.
Unless someone has a better idea looks like I am going to have to start an open source project myself!
发布评论
评论(3)
我还尝试使用 www.xml-rpc.net //www.mono-project.com/Main_Page" rel="nofollow noreferrer">Mono 在 Windows XP 上,它在 Mono .NET Runtime 中也能正常工作。 仅供大家参考。
I had also tried to run www.xml-rpc.net with Mono on Windows XP and it worked in Mono .NET Runtime also properly. Just for information for everybody.
我不久前使用过 www.xml-rpc.net 中的库并取得了一些成功,可以推荐它——它确实设计得很好,而且功能齐全。
I've used the library from www.xml-rpc.net some time ago with some success and can recommend it -- it did feel well designed and functional.
如果改变的只是方法名称(即方法签名是静态的),XML-RPC.NET 可以为您处理这个问题。 常见问题解答对此进行了解决,并指出“但是,有一些 XML-需要在运行时动态生成方法名称的 RPC API...”来自常见问题解答:
这会生成实现指定接口的 XmlRpcProxy。 设置 XmlRpcMethod 属性会导致 methodCalls 使用新方法名称。
If the method name is all that is changing (i.e., the method signature is static) XML-RPC.NET can handle this for you. This is addressed in the FAQ, noting "However, there are some XML-RPC APIs which require the method name to be generated dynamically at runtime..." From the FAQ:
This generates an XmlRpcProxy which implementes the specified interface. Setting the XmlRpcMethod attribute causes methodCalls to use the new method name.