Pass a time object to soapui and get exception

user1108948 picture user1108948 · Feb 25, 2013 · Viewed 30.8k times · Source

I use SoapUI to mock a WCF service. There is an object.

CallBeginTime = {2/22/2013 8:22:54 AM}

Date: {2/22/2013 12:00:00 AM}
Day: 22
DayOfWeek: Friday
DayOfYear: 53
Hour: 8
Kind: Unspecified
Millisecond: 0
Minute: 22
Month: 2
Second: 54
Ticks: 634971181740000000
TimeOfDay: {08:22:54}
Year: 2013

What I passed it as

<nsb:CallBeginTime>{2/22/2013 8:22:54 AM}</nsb:CallBeginTime> I got an exception

 <InnerException>
                    <HelpLink i:nil="true"/>
                    <InnerException i:nil="true"/>
                    <Message>The string '{2/22/2013 8:22:54 AM}' is not a valid AllXsd value.</Message>
                    <StackTrace>at System.Xml.XmlConvert.ToDateTime(String s, XmlDateTimeSerializationMode dateTimeOption)
                    at System.Xml.XmlConverter.ToDateTime(String value)</StackTrace>
                    <Type>System.FormatException</Type>
                 </InnerException>

Thanks for advice.

Answer

Chris Holwerda picture Chris Holwerda · Feb 25, 2013

I think you need to use this format:

YYYY-MM-DDTHH:MM:SS where T represents the start of the Time data

For example your example data would be:

2013-02-22T08:22:54

See XSD date datatype for more.