directxBOB
asked on
'nonNegativeInteger' is an invalid value for the XmlElementAttribute.DataType property. nonNegativeInteger cannot be converted to System.Int32.
I am getting the following error when I try and load my Web Service
'nonNegativeInteger' is an invalid value for the XmlElementAttribute.DataTy pe property. nonNegativeInteger cannot be converted to System.Int32.
[XmlElement(DataType="nonN egativeInt eger", Order=0, ElementName="AmountInEuroC ent")]
public int AmountInEuroCent
{
get { return amountInEuroCent; }
set
{
if ((amountInEuroCent != value))
{
amountInEuroCent = value;
RaisePropertyChanged("Amou ntInEuroCe nt");
}
}
}
The above Property appears to be the issue. I guess I could change it to a string but then that really wouldn't be ideal. As I would then have to do loads of conversions from string to int.
Any ideas?
'nonNegativeInteger' is an invalid value for the XmlElementAttribute.DataTy
[XmlElement(DataType="nonN
public int AmountInEuroCent
{
get { return amountInEuroCent; }
set
{
if ((amountInEuroCent != value))
{
amountInEuroCent = value;
RaisePropertyChanged("Amou
}
}
}
The above Property appears to be the issue. I guess I could change it to a string but then that really wouldn't be ideal. As I would then have to do loads of conversions from string to int.
Any ideas?
What is nonNegativeInteger? Is this a class you wrote?
ASKER
XML / SOAP Type
Can you try making your property uint instead of int? This is the correspondence of non negative integer.
ASKER
Now getting:
'nonNegativeInteger' is an invalid value for the XmlElementAttribute.DataTy pe property. nonNegativeInteger cannot be converted to System.UInt32.
'nonNegativeInteger' is an invalid value for the XmlElementAttribute.DataTy
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Cheers, I bounded them to String as a temp solution back when I posted the question. I believe it's got me around the problem but I really wanted to avoid doing Convert.ToInt
But I guess it can't be avoided.
But I guess it can't be avoided.
I don't think the overhead will be great. Even if you have it directly mapped, .Net will do the convertion and it won't be faster.