I'm trying to get a class from the server but the properties come with null value.
ERROR
Uncaught TypeError: Cannot read property 'Fserie' of null
Example SERVER
function TModelTeste.nfeChaveDeserializer(in_chave: String): TNFeChave;
begin
if Length(in_chave) <> 44 then
raise Exception.Create('Chave NF-e invalida');
Result := TNFeChave.Create;
Result.uf := Copy(in_chave, 1, 2);
Result.anomes := Copy(in_chave, 3, 4);
Result.cnpj := Copy(in_chave, 7, 14);
Result.modelo := Copy(in_chave, 21, 2);
Result.serie := Copy(in_chave, 23, 3);
Result.numero := Copy(in_chave, 26, 9);
Result.codigo := Copy(in_chave, 35, 9);
Result.digito := Copy(in_chave, 44, 1);
end;
Client:
procedure TFViewnotaPopup.nfeChaveDeserializer;
procedure OnResult(Response: TXDataClientResponse);
var
fNFeChave: TNFeChave;
begin
fNFeChave := TNFeChave.Create;
try
fNFeChave := TNFeChave(TJSObject(Response.Result)['value']);
edserie_nf.Text := fNFeChave.serie; <<<<<<<<<<<============ ERROR
ednumero.Text := fNFeChave.numero;
finally
fNFeChave.Free;
end;
end;
begin
XDataWebClient.RawInvoke('IModelTeste.nfeChaveDeserializer', [edchave.Text], @OnResult);
end;