My blog has moved and can now be found at http://blog.aniljohn.com

No action is needed on your part if you are already subscribed to this blog via e-mail or its syndication feed.

Saturday, December 10, 2005
« Web Service SLAs - Looking for resources... | Main | Interoperability (J2EE and .NET) Article... »

Dino recently posted an entry on the usage of Date and Time values when dealing with web services interop. He also points to a W3C Note on this topic.

This entry reminded me of an earlier article by Dan Rogers [MSFT] that provides great insight into this issue regardless of platform and provides best practices for handling this particular DateTime issue if working in .NET.  A key take-away from the above article as regards to DateTime usage in web services in .NET is “When using the .NET Framework version 1.0 and 1.1, DO NOT send a DateTime value that represents UCT time thru System.XML.Serialization. This goes for Date, Time and DateTime values. For Web services and other forms of serialization to XML involving System.DateTime, always make sure that the value in the DateTime value represents current machine local time. The serializer will properly decode an XML Schema-defined DateTime value that is encoded in GMT (offset value = 0), but it will decode it to the local machine time viewpoint.

BTW, Dan is one of the creators of XSDObjectGen which is a must have tool if working with web services on the .NET platform. If you look at the documentation for XSDObjectGen, you will note the following gem: “Special handling logic for DateTime types:  DateTime serialization properties are generated and illustrate the recommended best practice for working with local and universal time values that will properly serialize on another computer in another time zone without loss in precision.” Excellent!

Comments are closed.