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.

相关文章

vue阻止冒泡事件 阻止点击事件的执行 &lt;div @click=&a...
尝试过使用网友说的API接口获取 找到的都是失效了 暂时就使用...
后台我拿的数据是这样的格式: [ {id:1 , parentId: 0, name:...
JAVA下载文件防重复点击,防止多次下载请求,Cookie方式快速简...
Mip是什么意思以及作用有哪些