This is a mirror of official site: http://jasper-net.blogspot.com/

WCF Support for xs:date

| Monday, April 18, 2011
Introduction

Despite the fact that WCF technology is powerful and flexible, there are some areas requiring improvement. In this article, I'll show issues related to webservice date format interoperability and how it can be solved.

Background

My company is a financial institution which has many different applications exchanging data. Most of these applications are implemented in Java while mine exposes webservice implemented in WCF .NET.

To exchange dates, I’ve proposed an xs:dateTime format. This is because then I was not aware about the peculiarities of this type.

First issue: UTC format. When I was testing webservice with soapUI, I entered manually 1969-03-17T00:00:00.000+01:00 as an input argument for 1969-03-17 date of birth. Everything was fine. However when the actual webservice client sent 1969-03-16T23:00:00.000Z (equivalent datetime in UTC format), then it appeared that .NET treated this as 1969-03-16 date (one day shift).

One more explanation: I’m working in Poland, so the winter time is GMT+1 and summer time is GMT+2 CET zone with daylight savings time.

So it looks like UTC time is not correctly handled. Fortunately, a simple workaround exists:

if (date.Kind == DateTimeKind.Utc) 
   date = date.ToLocalTime()    

Read more: Codeproject

Posted via email from Jasper-net

0 comments: