Solving the null DateTime datatype problem, in a web service response.

Solving the null DateTime datatype problem, in a web service response.

In a standard/traditional .NET SOAP web service response, where a DateTime item has not been given a value, (ie the DateTime item is null) the SOAP web service should response without any value.

However in Outsystems platform, it was found that this has been done differently, the web service responses with the following <myDate>1900-01-01T00:00:00.0000000+11:00</myDate>

This is not the correct behaviour,....besides changing the dataTime item to a string then converting the response from DateTime value into a string, how else could this problem be solved? 
Hi Robert

As you may already know, this behavior comes from the fact that the Agile Platform does not use NULL values in its runtime. So for OutSystems, 1900-01-01 00:00:00 is the null date, and when you fill in a variable with a NullDate, you get that value.

If you are exposing a service to be consumed in OutSystems, things will work properly - unless you actually wanted to pass the date 1900-01-01 00:00:00. If exposing the web service to a third-party, you could explain the semantics and have the consumer deal with it appropriately.

There is another option, but not so elegant - passing a record with a single date value instead of a date attribute, and not filling it in when the date is actually a NullDate.

I don't know if that will serve your purposes, though.

Thanks for the reply,

We may have to solve this issue by changing the datatype from "DateTime" to a string, then check if the DateTime is not null then assign the "DateTime" value to the string,where as DateTime is null then do not assign a value.