Variations of this question have been asked apparently dozens of times, but the solution that I need seems to be extremely elusive. I'm hoping that this time is the charm!
I have a C# application which is communicating with a Java web service via SOAP xml. The application has imported the service using the WSDL without a problem. However, one of xml objects is of type dateTime.
<complexType name="Interaction">
<sequence>
<element name="ContactDate" type="dateTime" minOccurs="0" maxOccurs="1"/>
</sequence>
</complexType>
I have a date which I've retrieved from a database, which looks like this: 2013-07-10. I need to get it into the XML dateTime object using the UTC format: yyyy-MM-ddTHH:mm:ss.fffzzz
I can easily convert this to a properly parsed string. That's not the problem. The issue occurs when I try to load the data into the service object. I can't load the data as a string. It HAS to be a DateTime object, but DateTime refuses to use the UTC format.
I thought this might be a problem with serialization. I think it's failing to serialize properly when converting to xml to be sent to the web service. Here's the serialization information for this particular element:
[System.Xml.Serialization.XmlElementAttribute(Order=2)]
public System.DateTime ContactDate {
get {
return this.contactDateField;
}
set {
this.contactDateField = value;
this.RaisePropertyChanged("ContactDate");
}
}
Any ideas on what I might be missing or doing wrong? Any help would be greatly appreciated. Thanks!