Note that there are some explanatory texts on larger screens.

plurals
  1. POWeb Service Exception: "The formatter threw an exception while trying to deserialise the message"
    primarykey
    data
    text
    <p>Got a question. I get this error and I know it is due to the fact that int32 has a number limit of 2147483647. But I don't know why I am getting this error when the value in question (a telephone number of 11 digits) is defined as a string in our SQL database, a string in our web service and a string in our web application.</p> <p>I assume it is something to do with the way the service serialises and deserialises data over a connection, but I was wanting to know if there is a way to force Number to use only the string instead of parsing it when deserialisation happens. Or even get it to parse as int64.</p> <p>Here is the error exception. I removed the namespace and service name. It is the property Number that is causing the problem.</p> <blockquote> <p>There was an error deserializing the object of type .".ClientPhone[]. The value '07721545554' cannot be parsed as the type 'Int32'."</p> </blockquote> <p>And here is the code for the service and the service interface.</p> <pre><code>[DataContract] public class ClientPhone { [DataMember] public int? ClientNumberID { get; set; } [DataMember] public int? RefID { get; set; } [DataMember] public string Number { get; set; } [DataMember] public string NumberType { get; set; } [DataMember] public bool? PrimaryNumber { get; set; } } public partial class ClientNumberEntity { public int ClientNumbersID { get; set; } public Nullable&lt;int&gt; RefID { get; set; } public string ClientNumberType { get; set; } public string ClientNumber { get; set; } public Nullable&lt;bool&gt; PrimaryNumber { get; set; } public virtual ClientDataEntity ClientData { get; set; } } public List&lt;ClientPhone&gt; GetClientsPhoneByReference(int _reference) { OurDatabaseEntities context = new OurDatabaseEntities(); var phoneEntity = (from c in context.ClientNumberEntities where c.RefID == _reference select c).ToList(); if (phoneEntity != null) { return TranslateClientPhoneEntityToPhoneNumberList(phoneEntity); } else throw new Exception("Unable to get phone data"); } private List&lt;ClientPhone&gt; TranslateClientPhoneEntityToPhoneNumberList(List&lt;ClientNumberEntity&gt; numberEntities) { List&lt;ClientPhone&gt; phoneList = new List&lt;ClientPhone&gt;(); foreach (ClientNumberEntity numberEntity in numberEntities) { ClientPhone phoneListMember = new ClientPhone(); phoneListMember.ClientNumberID = numberEntity.ClientNumbersID; phoneListMember.RefID = numberEntity.RefID; phoneListMember.Number = numberEntity.ClientNumber; phoneListMember.NumberType = numberEntity.ClientNumberType; phoneListMember.PrimaryNumber = numberEntity.PrimaryNumber; phoneList.Add(phoneListMember); } return phoneList; } </code></pre> <p>Any advice on a solution would be greatly appreciated! Thanks :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload