Blank value in web service for Int64 type

后端 未结 1 1459
梦谈多话
梦谈多话 2020-12-19 04:28

I consume a web service that has a numeric element. The Delphi wsdl importer sets it up as Int64.

The web service allows this element to be blank. However, because i

相关标签:
1条回答
  • 2020-12-19 05:09

    Empty age (example)

    <E06_14></E06_14>
    

    could have a special meaning, for example be "unknown" age.

    In this case, the real question is how to make the field nillable on the Delphi side.

    From this post of 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.

    The DocWiki for the Import WSDL Wizard also shows two options related to nillable elements:

    • 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.

    0 讨论(0)
提交回复
热议问题