PeceKr
9 years agoNew Contributor
SoapUI isn't serializing nullable int
I have datacontract with datamember of type nullable int .
[DataMember(Order = 5,EmitDefaultValue = false)] public int? Zip { get; set; }
When I leave the Zip value empty and submit the request trough SoapUI I'm getting this error :
<InnerException i:nil="true"/> <Message>Input string was not in a correct format.</Message> <StackTrace>at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at System.Xml.XmlConvert.ToInt32(String s) at System.Xml.XmlConverter.ToInt32(String value)</StackTrace> <Type>System.FormatException</Type> </InnerException> <Message>The value '' cannot be parsed as the type 'Int32'.</Message> <StackTrace>at System.Xml.XmlConverter.ToInt32(String value) at System.Xml.XmlDictionaryReader.ReadElementContentAsInt() at System.Runtime.Serialization.XmlReaderDelegator.ReadElementContentAsInt() at ReadAddressSearchRequestFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] ) at System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context) at System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader) at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract) at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns) at System.Runtime.Serialization.DataContractSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName, DataContractResolver dataContractResolver) at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)</StackTrace> <Type>System.Xml.XmlException</Type> </InnerException>
When I run this through .net client , the request is serialized correctly and I'm getting good response.
Any ideas why I have this problem in SoapUI?
Thanks.