views:

194

answers:

2

Have a small script in Microsoft.NET 2.0 that deserializes a XML back to a typed object, connects dyanimcally to a web service using ServiceDescription and binds the deserialized typed object to the WebMethod inbound. The XML prior to serialization looks like below

<completion_time>12:19:38</completion_time> 

on the wire when communicating to the web service looks like below

<completion_time>12:19:38.0000000-04:00</completion_time>

with the timezone appended to the end. This is causing the time to be read differently when communicating to a web service at a different timezone. is there anyway to let XmlSerializer skip the timezone? Or any other known workarounds?

A: 

You can change the type of 'completion_time' field from DateTime to string and use datetime formater to get datetime string without timezone

DateTime date = DateTime.UtcNow; date.ToString("hh:mm:ss");

petkov_d
A: 

http://blogs.msdn.com/brada/archive/2004/04/13/112784.aspx

[XmlElementAttribute(DataType="date")]

public DateTime date;

or

[XmlAttributeAttribute(DataType="date")]

public DateTime date;
eschneider
Thanks eschneider, but the links says this solution doesn't work for SOAP Serializer.
G33kKahuna