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

Web服务 – Int64类型的Web服务中的空白值,第1张

概述我使用具有数字元素的Web服务. Delphi wsdl导入器将其设置为Int64. Web服务允许此元素为空.但是,因为它被定义为Int64,当我在Delphi中使用Web服务而不为其设置值时,它默认为0,因为它是Int64.但我需要它为空,Web服务不接受值0(0被定义为无效并由Web服务返回错误). 如果类型是Int64,我如何传递空值? 空的年龄(例子) <E06_14></E06_14> 我使用具有数字元素的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.

总结

以上是内存溢出为你收集整理的Web服务 – Int64类型的Web服务中的空白值全部内容,希望文章能够帮你解决Web服务 – Int64类型的Web服务中的空白值所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1103371.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-28
下一篇2022-05-28

发表评论

登录后才能评论

评论列表(0条)

    保存