Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Internet
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #3  
Antiguo 09-04-2021
balger balger is offline
Miembro
 
Registrado: may 2011
Posts: 30
Poder: 0
balger Va por buen camino
Gracias por responder. Por suerte pude resolver el tema.
La cosa esquemática es así

Código Delphi [-]
types
  Clase1 = Class
     RESTClient1: TRESTClient;
     RESTRequest1: TRESTRequest;
     RESTResponse1: TRESTResponse;
     OAuth2Authenticator1: TOAuth2Authenticator;

 private
    procedure ReqsSetBody;

  public 
     procedure create
     procedure destroy 
end

procedure create
  RESTClient1 := TRESTClient.Create(nil);
  RESTRequest1 := TRESTRequest.Create(nil);
  RESTResponse1 := TRESTResponse.Create(nil);
  OAuth2Authenticator1 := TOAuth2Authenticator.Create(nil);
end

procedure destroy
  FreeAndNil(OAuth2Authenticator1);
  FreeAndNil(RESTRequest1);
  FreeAndNil(RESTResponse1);
  FreeAndNil(RESTClient1);
end

procedure ReqsSetBody
var  
  jsnBody: TJSONObject;

begin
  jsnBody := TJSONObject.Create;
  try
    jsnBody.AddPair(lowercase(f.FieldName), VarToStr(Trim(f.Value1)));
    jsnBody.AddPair(lowercase(f.FieldName), TJSonNumber.Create(f.Value2));
    jsnBody.AddPair(lowercase(f.FieldName), DateToISO8601(f.Value3, True));

    RESTRequest1.AddBody(jsnBody);
    
  finally
    jsnBody.Free;
 end;

end;

El problema fue resuelto cambiando la visibilidad de (y todo lo que involucra)
var jsnBody: TJSONObject en procedure ReqsSetBody

a la sección privada de la clase y agregando su creacion a procedure create.

Desconozco si existe una mejor opción.
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Problema liberando memoria: punteros y matrices Bauhaus1975 Varios 10 24-12-2010 10:24:08
¿Bajo que licencias estan liberando sus productos? xander Debates 44 30-11-2006 17:16:15
Copias de seguridad liberando BBDD piccolo2101 SQL 3 17-01-2006 13:52:39


La franja horaria es GMT +2. Ahora son las 16:05:50.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi