In the code below the variable lRetorno must contain a string with an xml returned from the web service, but the value returned by lRetorno:= ws.WS_Eleg_Portador(ws_aux);
is being the message 'object reference not set to an instance of an object'. The communication with web service is ok, because in another function I was able to capture the data normally. I'm developing on Lazarus for Linux, the language is Free Pascal, does anyone know what it could be?
procedure TPharmaLink.Pac_Eleg_Portador(const pAutorizacao: String; var pTransacao: RTransacaoPBM);
var
ws : ConcentradorSoap;
ws_aux : WS_Eleg_Portador_Type;
lRetorno: WS_Eleg_PortadorResponse;
lCartao : String;
lCPF : String;
lTimeStm: String;
begin
inherited;
FPC_RegisterHTTP_Transport(); //InvRegistry.RegisterInvokeOptions(TypeInfo(concentradorSoap), ioDocument);
lCartao := '';
lCPF := '0';
lTimeStm:= DateTimeToStr(Now);
lTimeStm:= StringReplace(lTimeStm,'/','',[rfReplaceAll]);
lTimeStm:= StringReplace(lTimeStm,':','',[rfReplaceAll]);
lTimeStm:= StringReplace(lTimeStm,' ','',[rfReplaceAll]);
if Length(pAutorizacao) = 16
then lCartao:= pAutorizacao
else lCPF := pAutorizacao;
pTransacao.Erro:= '';
// Instanciando os objetos
ws_aux := WS_Eleg_Portador_Type.Create();
//lRetorno:= ws.WS_Eleg_Portador(Trim(GetIdentificacao), FProjeto, lTimeStm, lCartao, StrToInt64(lCpf), '' );
ws_aux.cIdentifica :=Trim(GetIdentificacao);
ws_aux.cProjeto :='SAN001';
ws_aux.cTimestamp :=lTimeStm;
ws_aux.cCartao :=lCartao;
ws_aux.nCPF :=StrToInt64(lCpf);
ws_aux.cCanal :='';
ws := wst_CreateInstance_ConcentradorSoap();
try
lRetorno:= ws.WS_Eleg_Portador(ws_aux);
except
on E: Exception do
pTransacao.Erro:= E.Message;
end;
[continua...]