XML DateTime exception

Hi All,

I hope you will beab able to help me out. I’m getting an XML DateTime exception when I call a web service. Do anyone one knows how I can trace this error or how can this be fixed?

Heres the exception details:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault><faultcode xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:DeserializationFailed</faultcode><faultstring xml:lang="en-US">The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter CCPCServiceForFileRetention:createdDate. The InnerException message was 'There was an error deserializing the object of type System.DateTime. The value '10/10/2007 12:01:00' cannot be parsed as the type 'DateTime'.'.  Please see InnerException for more details.</faultstring><detail><ExceptionDetail xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><HelpLink i:nil="true"/><InnerException><HelpLink i:nil="true"/><InnerException><HelpLink i:nil="true"/><InnerException><HelpLink i:nil="true"/><InnerException i:nil="true"/><Message>The string '10/10/2007 12:01:00' is not a valid AllXsd value.</Message><StackTrace>   at System.Xml.Schema.XsdDateTime..ctor(String text, XsdDateTimeFlags kinds)

 

   at System.Xml.XmlConvert.ToDateTime(String s, XmlDateTimeSerializationMode dateTimeOption)

 

   at System.Xml.XmlConverter.ToDateTime(String value)</StackTrace><Type>System.FormatException</Type></InnerException><Message>The value '10/10/2007 12:01:00' cannot be parsed as the type 'DateTime'.</Message><StackTrace>   at System.Xml.XmlConverter.ToDateTime(String value)

 

   at System.Xml.XmlConverter.ToDateTime(Byte[] buffer, Int32 offset, Int32 count)

 

   at System.Xml.ValueHandle.ToDateTime()

 

   at System.Xml.XmlBaseReader.ReadContentAsDateTime()

 

   at System.Xml.XmlDictionaryReader.ReadElementContentAsDateTime()

 

   at System.Runtime.Serialization.XmlReaderDelegator.ReadElementContentAsDateTime()

 

   at System.Runtime.Serialization.DateTimeDataContract.ReadXmlValue(XmlReaderDelegator reader, XmlObjectSerializerReadContext context)

 

   at System.Runtime.Serialization.DataContractSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName)

 

   at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName)</StackTrace><Type>System.Xml.XmlException</Type></InnerException><Message>There was an error deserializing the object of type System.DateTime. The value '10/10/2007 12:01:00' cannot be parsed as the type 'DateTime'.</Message><StackTrace>   at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName)

 

   at System.Runtime.Serialization.DataContractSerializer.ReadObject(XmlDictionaryReader reader, Boolean verifyObjectName)

 

   at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameterPart(XmlDictionaryReader reader, PartInfo part, Boolean isRequest)</StackTrace><Type>System.Runtime.Serialization.SerializationException</Type></InnerException><Message>The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter CCPCServiceForFileRetention:createdDate. The InnerException message was 'There was an error deserializing the object of type System.DateTime. The value '10/10/2007 12:01:00' cannot be parsed as the type 'DateTime'.'.  Please see InnerException for more details.</Message><StackTrace>   at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameterPart(XmlDictionaryReader reader, PartInfo part, Boolean isRequest)

 

   at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameter(XmlDictionaryReader reader, PartInfo part, Boolean isRequest)

 

   at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameters(XmlDictionaryReader reader, PartInfo[] parts, Object[] parameters, Boolean isRequest)

 

   at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, String action, MessageDescription messageDescription, Object[] parameters, Boolean isRequest)

 

   at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest)

 

   at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeRequest(Message message, Object[] parameters)

 

   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc& rpc)

 

   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)

 

   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)

 

   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)

 

   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc)

 

   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc)

 

   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc)

 

   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</StackTrace><Type>System.ServiceModel.Dispatcher.NetDispatcherFaultException</Type></ExceptionDetail></detail></s:Fault></s:Body></s:Envelope>
 

Many Thanks in Advance!!
S

RPC-style web services are evil.

The date/time string is not of the expected format. Find out what the format should be and then make sure that when you create the SOAP message that it has that format.

The W3C XML Schema dateTime data type has valid values in one of the following forms:

  • trailingZ 2007-11-28T16:00:00.000Z (time at GMT)
  • offset 2007-11-28T16:00:00.000-04:00 (4PM US Eastern)

Mark

Thanks! When I used “2007-11-28T16:00:00.000Z” it has worked. Thanks again!