how is it possible to set the xsi:nil="true" attribute on only single elements? With the runtime-flag "SOAP_XML_NIL" I will set it globally, so it affects every attribute.
Thank you
how is it possible to set the xsi:nil="true" attribute on only single elements? With the runtime-flag "SOAP_XML_NIL" I will set it globally, so it affects every attribute.
Thank you
To add xsi:nil="true"
automatically to the XML payload when a class/struct member is NULL, you will only need to annotate the member as required (with a 1
):
class ns__some_data
{
public:
int *some_member 1; // nillable pointer & element is marked as required
};
When setting ns__some_data::some_member = NULL
, the XML will have the xsi:nil
attribute, which is what I think you want:
<ns:some-data>
<some-member xsd:nil="true"/>
</ns:some-data>
To make sure this works as expected, you will need to upgrade to the latest version of gSOAP (2.8.28 or later).