199
Views
4
Comments
[Integration] Mapping boolean values
Question

Hi all,

I am developing an application where we have to consume a SOAP web service. The information sent contains some boolean fields, and I came across with some mapping issues.

Some context: some boolean value mappings are not always applicable, and therefore I only want to map them into the request structure sometimes, according to the specific applicability. 

Problem: when I map a "False" value, it is not sent in the request structure. I believe this happens due to the attribute property (in the request structure) 'Send Default Value'. So, when I map a boolean as "False", and "Send Default Value" is set to "No", the field is not sent. However, if I set the "Send Default Value" to "Yes", it always sends the default value, even if I don't assign it a boolean value on the mappings.

Have you ever came across a situation like this? What do you usually do?


Please let me know if I was not clear enough.

Thanks,

Maria


mvp_badge
MVP
Rank: #18

Hi Maria,

Many times SOAP have extra boolean variables like <variableName>Specified.

These "Specified" fields are only generated on optional parameters that are structs. (int, datetime, decimal etc). All such variables will have additional variable generated with the name <variableName>Specified.

An optional boolean, if not passed, would still have the dafault value of false.  How do you differentiate between this and the one that was actually  passed with a value false ? The "specified" field lets you know if the optional boolean is passed or not. If the "specified" field is false, the value is not passed across. If it true, the boolean is passed.

Alternatively, you can consider using data types like bool? this will avoid generation of the "specified" fields.

Maybe the SOAP web service you try to consume provides these fields too, that you can use?

Also note the same issue arises for numerics and date datetime structures.

Regards,

Daniel

mvp_badge
MVP
Rank: #18

Hi Maria,

Just wondering where you able to solve your problem?

Regards,

Daniel

Hi Maria,


I was wondering if you were able to get to the bottom of this as we are experiencing the same issue that you are describing!