How do I tell gsoap to not serialize NULL elements?

91 Views Asked by At

The class I'm using for my SOAP requests has a ton of optional elements, and they're getting serialized as

<REQUEST>
  <REQUIRED_1>some value</REQUIRED_1>
  <OPTIONAL_1 xsd:nil="true"/>
  <OPTIONAL_2 xsd:nil="true"/>
  <OPTIONAL_3>some value</OPTIONAL_3>
</REQUEST>

(this is the provider's dumb WSDL, not mine).

The provider just dropped a security patch and it's barfing on some of these elements (getting marshaling errors on items that are supposed to store numeric strings). I've been going through the Genevia documentation and looking at the serialization code to figure this out, but does anyone know of a quick and easy (hah) way to tell gsoap to not serialize empty or null elements, such that they don't show up in the request at all?

<REQUEST>
  <REQUIRED_1>some value</REQUIRED_1>
  <OPTIONAL_3>some value</OPTIONAL_3>
</REQUEST>

Some secret option to wsdl2h or soap2cpp I haven't found? Maybe something in typemap.dat? Do I have to write a custom serializer for the type (please god no)?

0

There are 0 best solutions below