XML-RPC:处理 64 位值的最佳方式?

发布于 2024-07-05 22:39:33 字数 136 浏览 4 评论 0原文

因此官方 XML-RPC 标准不支持 64 位值。 但在当今时代,64 位值越来越普遍。

你如何处理这些? 哪些 XML-RPC 扩展最常见? 有哪些语言绑定? 我对 Python 和 C++ 特别感兴趣,但感谢所有信息。

So the official XML-RPC standard doesn't support 64-bit values. But in these modern times, 64-bit values are increasingly common.

How do you handle these? What XML-RPC extensions are the most common? What language bindings are there? I'm especially interested in Python and C++, but all information is appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

初心 2024-07-12 22:39:33

我不知道如何扩展 XMLRPC,但我确实找到了

在 XML-RPC 中,一切都被传输
作为一个字符串,所以我不认为
选择真的那么糟糕 - 除了
当然还有额外的笨拙
用于调用显式转换
功能。

但是不,XML-RPC 没有数据
可以表示上述整数的类型
2**32。 如果你能接受失败
精度,你可以使用双精度(但是
你仍然需要转换
发件人明确指出)。

I don't know anything about how XMLRPC could be extended but I did find this mail about the subject:

In XML-RPC, everything is transmitted
as a string, so I don't think that
choice is really that bad - except of
course for the additional clumsiness
for invoking explicit conversion
functions.

But no, XML-RPC doesn't have a data
type that can represent integers above
2**32. If you can accept losing
precision, you can use doubles (but
you still would have to convert
explicitly on the sender).

孤独岁月 2024-07-12 22:39:33

XML-RPC.NET 已支持自版本 2.5.0(2010 年 9 月 5 日)以来。

XML-RPC.NET has supported <i8> since release 2.5.0 (5th September 2010).

债姬 2024-07-12 22:39:33

有些库确实支持 64 位扩展,但似乎没有标准。 例如, xmlrpc-c 有一个所谓的 i8,但它不能与 python 一起使用(至少默认情况下不是)。

我建议:

  • 手动将整数转换为字符串并按原样发送。 无论如何,XMLRPC 都会将其转换为字符串,所以我认为这是合理的。
  • 将其分成两个 32 位整数并按原样发送。

Some libraries support 64 bits extensions, indeed, but there doesn't seem to be a standard. xmlrpc-c, for example, has a so called i8 but it doesn't work with python (at least not by default).

I would recommend to either:

  • Convert the integer to string by hand and send it as such. XMLRPC will convert it to string anyway, so I would say this is reasonable.
  • Break it in two 32 bits integers and send it as such.
固执像三岁 2024-07-12 22:39:33

使用“i8”作为数据类型变得越来越普遍。 我最近将其添加到我的 Perl XML-RPC 模块中 (http://metacpan.org/pod/RPC ::XML),以响应来自一个大团体的请求,该团体需要它才能与用 Java 编写的服务器一起工作。 我不知道服务器使用什么工具包,但它已经接受 i8 作为一种类型。

我觉得仍然需要解决的一件事是“i4”的“int”别名是否也应该接受 i8,就像它目前处理 i4 的方式一样。 或者,就此而言,如果输入为 i8 的参数应该安静地接受输入为 i4 的输入。 当您不需要 SOAP 的所有覆盖范围时,XML-RPC 作为一种轻量级、低开销的协议具有巨大的潜力,但它在 REST 和 SOAP 之间的宗教战争中经常被忽视。

XML-RPC 需要一些更新和修订,如果我们能让原作者允许的话......

The use of "i8" as a data-type is becoming more and more common. I recently added this to my Perl XML-RPC module (http://metacpan.org/pod/RPC::XML) in response to a request from a large group that needed it in order to work with a server written in Java. I don't know what toolkit the server used, but it was already accepting i8 as a type.

One thing that I feel still has to be addressed, is whether the "int" alias for "i4" should also accept i8, the way it currently does i4. Or, for that matter, if a parameter typed as i8 should quietly accept an input typed as i4. XML-RPC has great potential as a lightweight, low-overhead protocol handy when you don't need all the coverage of SOAP, but it is often overlooked in the religious wars between REST and SOAP.

XML-RPC is in need of some updating and revision, if we could just get the original author to permit it...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文