I have a WCF service. It has a following attributes.
[DataMember]
public List<uttAppointmentPhoneList> AppointmentPhoneList { get; set; }
public class uttAppointmentPhoneList
{
string _PhoneType;
Int32 _PhoneNumber;
bool _IsDelete;
[DataMember]
public string PhoneType
{
get { return _PhoneType; }
set { _PhoneType = value; }
}
[DataMember]
public Int32 PhoneNumber
{
get { return _PhoneNumber; }
set { _PhoneNumber = value; }
}
[DataMember]
public bool IsDelete
{
get { return _IsDelete; }
set { _IsDelete = value; }
}
}
But I get the following error when I send a request.
The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter. The InnerException message was ‘There was an error deserializing the object of type MarshfieldClinic.Denbigh.AppointmentService.Sync.DataContracts.mydayapp. The value ‘3456787463’ cannot be parsed as the type ‘Int32′.’. Please see InnerException for more details.
Any Ideas why this is happening? Thanks
That’s totally wrong.
A phone number is a string, not a number.
This specific error is happening because most phone numbers will not fit in 32 bits.
However, you need to use a string.