PC Review


Reply
Thread Tools Rate Thread

DateTime being changed during Xml Serialization of a DataSet using WSE 1.0

 
 
Chris Langston
Guest
Posts: n/a
 
      20th May 2004
I have a Web Service that returns a DataSet to a client. I'm seeing some
strange behavior where the Date of one of my values is being changed from
the time the DataSet leaves the Web Service to the time when it shows up at
the Client application.

Below is the DataSet serialized to Xml at the Web Service before it is sent
to the Client: This issue is with the
<ServDate>2004-05-20T00:00:00.0000000-05:00</ServDate>

<NewDataSet>
<Table>
<SiteID>0061</SiteID>
<ServDate>2004-05-20T00:00:00.0000000-05:00</ServDate>
<ServTime>1900-01-01T15:26:03.0000000-06:00</ServTime>
<TransNbr>144</TransNbr>
<ID>594258826X</ID>
<TransType>1</TransType>
<Cashier>1</Cashier>
<TranClass />
<CheckNum>-1</CheckNum>
<Tendered>0.0100</Tendered>
<PayType>51</PayType>
<Allocation>1</Allocation>
<Received>false</Received>
</Table>
<Transaction>
<TransactionID>236ac886-e7f3-4980-92cf-cc0c83232da4</TransactionID>
<SentDateTime>2004-05-20T15:28:07.5625000-05:00</SentDateTime>
</Transaction>
</NewDataSet>

Here is the DataSet when it shows up at the Client site: The <ServDate> has
been changed from 2004-05-20 to 2004-05-19

<ServDate>2004-05-19T23:00:00.0000000-06:00</ServDate>

<NewDataSet>
<Table>
<SiteID>0061</SiteID>
<ServDate>2004-05-19T23:00:00.0000000-06:00</ServDate>
<ServTime>1900-01-01T15:26:03.0000000-06:00</ServTime>
<TransNbr>144</TransNbr>
<ID>594258826X</ID>
<TransType>1</TransType>
<Cashier>1</Cashier>
<TranClass />
<CheckNum>-1</CheckNum>
<Tendered>0.0100</Tendered>
<PayType>51</PayType>
<Allocation>1</Allocation>
<Received>false</Received>
</Table>
<Transaction>
<TransactionID>236ac886-e7f3-4980-92cf-cc0c83232da4</TransactionID>
<SentDateTime>2004-05-20T14:28:07.5625000-06:00</SentDateTime>
</Transaction>
</NewDataSet>

The web server is running Windows 2003 Server Standards Edition with .NET
1.1 and the Client server is running Windows Xp Professional SP1 with .NET
1.1.

Any suggestions on how these values could be getting changed.

The servers are both in Central Time Zone, the clocks are all setup
properly, just off by a about 2 minutes, which doesn't seem to be causing
any problems.

We are using the WSE 1.0 to Encrypt and Decrypt the Xml packets that are
being sent back and forth between the client and the server.

Thanks,

Chris Langston


 
Reply With Quote
 
 
 
 
Lucien
Guest
Posts: n/a
 
      21st May 2004
Could it be that the time is not changed but expressed in UTC? This is what
I suspect.

"Chris Langston" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> I have a Web Service that returns a DataSet to a client. I'm seeing some
> strange behavior where the Date of one of my values is being changed from
> the time the DataSet leaves the Web Service to the time when it shows up

at
> the Client application.
>
> Below is the DataSet serialized to Xml at the Web Service before it is

sent
> to the Client: This issue is with the
> <ServDate>2004-05-20T00:00:00.0000000-05:00</ServDate>
>
> <NewDataSet>
> <Table>
> <SiteID>0061</SiteID>
> <ServDate>2004-05-20T00:00:00.0000000-05:00</ServDate>
> <ServTime>1900-01-01T15:26:03.0000000-06:00</ServTime>
> <TransNbr>144</TransNbr>
> <ID>594258826X</ID>
> <TransType>1</TransType>
> <Cashier>1</Cashier>
> <TranClass />
> <CheckNum>-1</CheckNum>
> <Tendered>0.0100</Tendered>
> <PayType>51</PayType>
> <Allocation>1</Allocation>
> <Received>false</Received>
> </Table>
> <Transaction>
> <TransactionID>236ac886-e7f3-4980-92cf-cc0c83232da4</TransactionID>
> <SentDateTime>2004-05-20T15:28:07.5625000-05:00</SentDateTime>
> </Transaction>
> </NewDataSet>
>
> Here is the DataSet when it shows up at the Client site: The <ServDate>

has
> been changed from 2004-05-20 to 2004-05-19
>
> <ServDate>2004-05-19T23:00:00.0000000-06:00</ServDate>
>
> <NewDataSet>
> <Table>
> <SiteID>0061</SiteID>
> <ServDate>2004-05-19T23:00:00.0000000-06:00</ServDate>
> <ServTime>1900-01-01T15:26:03.0000000-06:00</ServTime>
> <TransNbr>144</TransNbr>
> <ID>594258826X</ID>
> <TransType>1</TransType>
> <Cashier>1</Cashier>
> <TranClass />
> <CheckNum>-1</CheckNum>
> <Tendered>0.0100</Tendered>
> <PayType>51</PayType>
> <Allocation>1</Allocation>
> <Received>false</Received>
> </Table>
> <Transaction>
> <TransactionID>236ac886-e7f3-4980-92cf-cc0c83232da4</TransactionID>
> <SentDateTime>2004-05-20T14:28:07.5625000-06:00</SentDateTime>
> </Transaction>
> </NewDataSet>
>
> The web server is running Windows 2003 Server Standards Edition with .NET
> 1.1 and the Client server is running Windows Xp Professional SP1 with .NET
> 1.1.
>
> Any suggestions on how these values could be getting changed.
>
> The servers are both in Central Time Zone, the clocks are all setup
> properly, just off by a about 2 minutes, which doesn't seem to be causing
> any problems.
>
> We are using the WSE 1.0 to Encrypt and Decrypt the Xml packets that are
> being sent back and forth between the client and the server.
>
> Thanks,
>
> Chris Langston
>
>



 
Reply With Quote
 
Chris Langston
Guest
Posts: n/a
 
      21st May 2004
If the time is expressed in UTC why would it change from one date to the
next date? Can you make a recommendation on what I should do properly
handle conditions like this?

Our software is running all over the country and for whatever reason, the
problem only ocurrs for this one particular client installation.

Thanks,

Chris


"Lucien" <Xlucienen (E-Mail Removed)> wrote in message
news:40ae4920$(E-Mail Removed)...
> Could it be that the time is not changed but expressed in UTC? This is

what
> I suspect.
>
> "Chris Langston" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > I have a Web Service that returns a DataSet to a client. I'm seeing

some
> > strange behavior where the Date of one of my values is being changed

from
> > the time the DataSet leaves the Web Service to the time when it shows up

> at
> > the Client application.
> >
> > Below is the DataSet serialized to Xml at the Web Service before it is

> sent
> > to the Client: This issue is with the
> > <ServDate>2004-05-20T00:00:00.0000000-05:00</ServDate>
> >
> > <NewDataSet>
> > <Table>
> > <SiteID>0061</SiteID>
> > <ServDate>2004-05-20T00:00:00.0000000-05:00</ServDate>
> > <ServTime>1900-01-01T15:26:03.0000000-06:00</ServTime>
> > <TransNbr>144</TransNbr>
> > <ID>594258826X</ID>
> > <TransType>1</TransType>
> > <Cashier>1</Cashier>
> > <TranClass />
> > <CheckNum>-1</CheckNum>
> > <Tendered>0.0100</Tendered>
> > <PayType>51</PayType>
> > <Allocation>1</Allocation>
> > <Received>false</Received>
> > </Table>
> > <Transaction>
> > <TransactionID>236ac886-e7f3-4980-92cf-cc0c83232da4</TransactionID>
> > <SentDateTime>2004-05-20T15:28:07.5625000-05:00</SentDateTime>
> > </Transaction>
> > </NewDataSet>
> >
> > Here is the DataSet when it shows up at the Client site: The <ServDate>

> has
> > been changed from 2004-05-20 to 2004-05-19
> >
> > <ServDate>2004-05-19T23:00:00.0000000-06:00</ServDate>
> >
> > <NewDataSet>
> > <Table>
> > <SiteID>0061</SiteID>
> > <ServDate>2004-05-19T23:00:00.0000000-06:00</ServDate>
> > <ServTime>1900-01-01T15:26:03.0000000-06:00</ServTime>
> > <TransNbr>144</TransNbr>
> > <ID>594258826X</ID>
> > <TransType>1</TransType>
> > <Cashier>1</Cashier>
> > <TranClass />
> > <CheckNum>-1</CheckNum>
> > <Tendered>0.0100</Tendered>
> > <PayType>51</PayType>
> > <Allocation>1</Allocation>
> > <Received>false</Received>
> > </Table>
> > <Transaction>
> > <TransactionID>236ac886-e7f3-4980-92cf-cc0c83232da4</TransactionID>
> > <SentDateTime>2004-05-20T14:28:07.5625000-06:00</SentDateTime>
> > </Transaction>
> > </NewDataSet>
> >
> > The web server is running Windows 2003 Server Standards Edition with

..NET
> > 1.1 and the Client server is running Windows Xp Professional SP1 with

..NET
> > 1.1.
> >
> > Any suggestions on how these values could be getting changed.
> >
> > The servers are both in Central Time Zone, the clocks are all setup
> > properly, just off by a about 2 minutes, which doesn't seem to be

causing
> > any problems.
> >
> > We are using the WSE 1.0 to Encrypt and Decrypt the Xml packets that are
> > being sent back and forth between the client and the server.
> >
> > Thanks,
> >
> > Chris Langston
> >
> >

>
>



 
Reply With Quote
 
Guest
Posts: n/a
 
      8th Jun 2004
I've also encountered this bug in the XML serialization of DateTimes. See
the following for more background:
http://blogs.msdn.com/dareobasanjo/a...14/113179.aspx
http://blogs.msdn.com/brada/archive/...13/112784.aspx

For us the solution (in a remoting scenario) was to use binary serialization
as described in this article:
http://support.microsoft.com/default...b;en-us;829740

However, if you've found a solution for the web service scenario I'd love to
hear about it.

-Steve



"Chris Langston" <(E-Mail Removed)> wrote in message
news:%23$%(E-Mail Removed)...
> If the time is expressed in UTC why would it change from one date to the
> next date? Can you make a recommendation on what I should do properly
> handle conditions like this?
>
> Our software is running all over the country and for whatever reason, the
> problem only ocurrs for this one particular client installation.
>
> Thanks,
>
> Chris
>
>
> "Lucien" <Xlucienen (E-Mail Removed)> wrote in message
> news:40ae4920$(E-Mail Removed)...
> > Could it be that the time is not changed but expressed in UTC? This is

> what
> > I suspect.
> >
> > "Chris Langston" <(E-Mail Removed)> wrote in message
> > news:%(E-Mail Removed)...
> > > I have a Web Service that returns a DataSet to a client. I'm seeing

> some
> > > strange behavior where the Date of one of my values is being changed

> from
> > > the time the DataSet leaves the Web Service to the time when it shows

up
> > at
> > > the Client application.
> > >
> > > Below is the DataSet serialized to Xml at the Web Service before it is

> > sent
> > > to the Client: This issue is with the
> > > <ServDate>2004-05-20T00:00:00.0000000-05:00</ServDate>
> > >
> > > <NewDataSet>
> > > <Table>
> > > <SiteID>0061</SiteID>
> > > <ServDate>2004-05-20T00:00:00.0000000-05:00</ServDate>
> > > <ServTime>1900-01-01T15:26:03.0000000-06:00</ServTime>
> > > <TransNbr>144</TransNbr>
> > > <ID>594258826X</ID>
> > > <TransType>1</TransType>
> > > <Cashier>1</Cashier>
> > > <TranClass />
> > > <CheckNum>-1</CheckNum>
> > > <Tendered>0.0100</Tendered>
> > > <PayType>51</PayType>
> > > <Allocation>1</Allocation>
> > > <Received>false</Received>
> > > </Table>
> > > <Transaction>
> > >

<TransactionID>236ac886-e7f3-4980-92cf-cc0c83232da4</TransactionID>
> > > <SentDateTime>2004-05-20T15:28:07.5625000-05:00</SentDateTime>
> > > </Transaction>
> > > </NewDataSet>
> > >
> > > Here is the DataSet when it shows up at the Client site: The

<ServDate>
> > has
> > > been changed from 2004-05-20 to 2004-05-19
> > >
> > > <ServDate>2004-05-19T23:00:00.0000000-06:00</ServDate>
> > >
> > > <NewDataSet>
> > > <Table>
> > > <SiteID>0061</SiteID>
> > > <ServDate>2004-05-19T23:00:00.0000000-06:00</ServDate>
> > > <ServTime>1900-01-01T15:26:03.0000000-06:00</ServTime>
> > > <TransNbr>144</TransNbr>
> > > <ID>594258826X</ID>
> > > <TransType>1</TransType>
> > > <Cashier>1</Cashier>
> > > <TranClass />
> > > <CheckNum>-1</CheckNum>
> > > <Tendered>0.0100</Tendered>
> > > <PayType>51</PayType>
> > > <Allocation>1</Allocation>
> > > <Received>false</Received>
> > > </Table>
> > > <Transaction>
> > >

<TransactionID>236ac886-e7f3-4980-92cf-cc0c83232da4</TransactionID>
> > > <SentDateTime>2004-05-20T14:28:07.5625000-06:00</SentDateTime>
> > > </Transaction>
> > > </NewDataSet>
> > >
> > > The web server is running Windows 2003 Server Standards Edition with

> .NET
> > > 1.1 and the Client server is running Windows Xp Professional SP1 with

> .NET
> > > 1.1.
> > >
> > > Any suggestions on how these values could be getting changed.
> > >
> > > The servers are both in Central Time Zone, the clocks are all setup
> > > properly, just off by a about 2 minutes, which doesn't seem to be

> causing
> > > any problems.
> > >
> > > We are using the WSE 1.0 to Encrypt and Decrypt the Xml packets that

are
> > > being sent back and forth between the client and the server.
> > >
> > > Thanks,
> > >
> > > Chris Langston
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Richard Thombs
Guest
Posts: n/a
 
      16th Jun 2004
My solution is to change all DateTime columns into System.String columns
before my WebService returns the DataSet. Sucky, but it gets around this
issue.

Dino, if you have a solution to the problem I'd love to hear it.

Specifically for a senario like this:

1. Select a DateTime column from a SQL Server table
2. Return the results as a DataSet in a WebService.
3. On a client in a DIFFERENT TIMEZONE, successfully retrieve the
original DateTime value rather than one that has been automagically
adjusted by the difference in timezones.

R.
 
Reply With Quote
 
Guest
Posts: n/a
 
      18th Jun 2004
We went the string route for web services too.

It seems the root issue is that the Xml serialization of a DateTime ALWAYS
inserts the time zone, and there's no way to tell it that you're using UTC
data. Here's another example showing the problem for those of us in
EST/EDT. The output looks like this, showing that the values are altered
simply by serialization to Xml and then back again into a DataSet.

************************
Table values...
4/4/2004 2:00:00 AM
4/4/2004 3:00:00 AM

Table values...
4/4/2004 3:00:00 AM
4/4/2004 3:00:00 AM
************************

class Class1 {

[STAThread]

static void Main(string[] args) {

DataSet MyDataSet = new DataSet();

DataTable MyTable = new DataTable();

MyTable.Columns.Add( "MyDateTime", typeof(DateTime) );

MyDataSet.Tables.Add( MyTable );

MyTable.Rows.Add( new object[] { new DateTime(2004,4,4,2,0,0) } );

MyTable.Rows.Add( new object[] { new DateTime(2004,4,4,3,0,0) } );

ShowDateValues( MyDataSet.Tables[0] );

MyDataSet.WriteXml( @"C:\MyDataSet.xml", XmlWriteMode.WriteSchema );

MyDataSet = new DataSet();

MyDataSet.ReadXml( @"C:\MyDataSet.xml" );

ShowDateValues( MyDataSet.Tables[0] );


Console.ReadLine();


}

private static void ShowDateValues( DataTable MyTable ) {


Console.WriteLine("Table values...");

foreach( DataRow CurrentRow in MyTable.Rows ) {

Console.WriteLine( CurrentRow[0] );

}

Console.WriteLine();

}

}



"Richard Thombs" <(E-Mail Removed)> wrote in message
news:W32Ac.58145$%T.55608@okepread05...
> My solution is to change all DateTime columns into System.String columns
> before my WebService returns the DataSet. Sucky, but it gets around this
> issue.
>
> Dino, if you have a solution to the problem I'd love to hear it.
>
> Specifically for a senario like this:
>
> 1. Select a DateTime column from a SQL Server table
> 2. Return the results as a DataSet in a WebService.
> 3. On a client in a DIFFERENT TIMEZONE, successfully retrieve the
> original DateTime value rather than one that has been automagically
> adjusted by the difference in timezones.
>
> R.



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DateTime wrapper serialization Jarlaxle Microsoft C# .NET 1 11th Mar 2008 02:00 AM
Patch for DateTime serialization =?Utf-8?B?QnJpYW4=?= Microsoft Dot NET Framework 1 13th Aug 2007 11:58 PM
Custom DateTime serialization Zachary Turner Microsoft Dot NET 3 18th Aug 2006 07:23 PM
2.0 to 1.1 Version Tolerant DateTime Serialization Mork Microsoft Dot NET Framework 0 17th Jan 2006 11:25 PM
.NET Webservice - DateTime XML serialization wrong? (please help) RobertD Microsoft ADO .NET 0 4th Oct 2004 11:22 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:59 AM.