gpt4 book ai didi

web-services - Int64 类型的 Web 服务中的空白值

转载 作者:行者123 更新时间:2023-11-30 13:03:31 25 4
gpt4 key购买 nike

我使用了一个包含数字元素的网络服务。 Delphi wsdl 导入程序将其设置为 Int64。

Web 服务允许此元素为空。但是,因为它被定义为 Int64,所以当我在 Delphi 中使用 Web 服务而没有为其设置值时,它默认为 0,因为它是 Int64。但我需要它为空并且 Web 服务不会接受值 0(0 被定义为无效并由 Web 服务返回错误)。

如果类型是 Int64,我如何传递空值?

最佳答案

空龄(例子)

<E06_14></E06_14>

可能有特殊含义,例如“未知”年龄。

在这种情况下,真正的问题是如何在 Delphi 端使该字段可以为空。

来自 this post J.M. Babet 的:

Support for 'nil' has been an ongoing issue. Several built-in types of Delphi are not nullable. So we opted to use a class for these cases (not elegant but it works). So with the latest update for Delphi 2007 I have added several TXSxxxx types to help with this. Basically: TXSBoolean, TXSInteger, TXSLong, etc. TXSString was already there but it was not registered. Now it is. When importing a WSDL you must enable the Use 'TXSString for simple nillable types' option to make the importer switch to TXSxxxx types. On the command line it is the "-0z+" option.

DocWiki for the Import WSDL Wizard还显示了与可空元素相关的两个选项:

  • Process nillable and optional elements - Check this option to make the WSDL importer generate relevant information about optional and nillable properties. This information is used by the SOAP runtime to allow certain properties be nil.

  • Use TXSString for simple nillable types - The WSDL standard allows simple types to be nil, in Delphi or NULL, in C++, while Delphi and C++ do not allow that. Check this option to make the WSDL importer overcome this limitation by using instances of wrapper classes.

关于web-services - Int64 类型的 Web 服务中的空白值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12645527/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com