开发者

what's the minimum / maximum value of the datetime data type when using SOAP?

开发者 https://www.devze.com 2023-04-13 05:37 出处:网络
开发者_开发知识库I have an interoperable WCF service which needs to provide a DateTime value to the clients.
开发者_开发知识库

I have an interoperable WCF service which needs to provide a DateTime value to the clients.

I want to provide the maximum value of this DateTime if a certain field is set to 'unlimited' (DateTime.MaxValue in .NET). But what exact value to be passed to the clients as maximum in order to keep it interoperable and clients to treat it as "unlimited"?

I am worried because inside .Net DateTime.Max is ok, but Linux's max datetime value is 19 January 2038.

Shall I check the maximum value of datetime for SOAP specification ?

EDIT: I really want to make use of this DateTime value, without adding any other fields to my contracts! What is the maximum date-time allowed by SOAP? For some reasons I could not find this on google.

Thanks.


Ok, here is what I'm using right now:

Per SOAP's datetime decription here: http://www.w3.org/TR/xmlschema-2/#dateTime , if I understand correct, the values could be between year 0001 and year 9999, very similar to what .NET covers.

So I am using these values for minimum and maximum for the server side. On the client side the value is retrieved and mapped to its own meaning of minimum and maximum (e.g linux max/min datetime). Yes, this implies the clients are pretty much forced to do this mapping right before/after SOAP communication.

Update: It was bad from my part to not realize that I could use nullable values (DateTime?) through the channel. Seems I learned about its existence a bit later (quite lame).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号