Web服务 – Int64类型的Web服务中的空白值

前端之家收集整理的这篇文章主要介绍了Web服务 – Int64类型的Web服务中的空白值前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我使用具有数字元素的Web服务. Delphi wsdl导入器将其设置为Int64.

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

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

解决方法

空的年龄(例子)
<E06_14></E06_14>

可能有特殊意义,例如“未知”年龄.

在这种情况下,真正的问题是如何使字段在Delphi端可用.

从J.M. Babet的this post开始:

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.

  • @H_404_48@
原文链接:https://www.f2er.com/html/231399.html

猜你在找的HTML相关文章