Ver Mensaje Individual
  #1  
Antiguo 30-04-2015
jlrdz jlrdz is offline
Miembro
NULL
 
Registrado: ene 2011
Posts: 50
Reputación: 14
jlrdz Va por buen camino
Question Llenar datos de TRemotable

Saludos y buenas tardes primero que nada , estoy tratando de conectarme a un WebService por medio de SOAP para envío de imágenes con su descripción y otros datos.

Mi problema es que cuando intento llenar los datos de los parametros TRemotable lo estoy haciendo mal y no sé de qué forma deba llenarlos, aquí dejo parte del archivo .pas que me generó el wsdl del webservice.

Código Delphi [-]
unit ReceptorImagenesService;

interface

uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;

const
  IS_OPTN = $0001;


type

  recibirImagenResponse2 = class;
  recibirImagenResponse = class;
  recibirImagen2       = class;
  recibirImagen        = class;
  usuarioWSVO          = class;
  respuestaWSVO        = class;
  imagenWSVO           = class;

  recibirImagenResponse2 = class(TRemotable)
  private
    Freturn: respuestaWSVO;
    Freturn_Specified: boolean;
    procedure Setreturn(Index: Integer; const ArespuestaWSVO: respuestaWSVO);
    function  return_Specified(Index: Integer): boolean;
  public
    destructor Destroy; override;
  published
    property return: respuestaWSVO  Index (IS_OPTN) read Freturn write Setreturn stored return_Specified;
  end;


  recibirImagenResponse = class(recibirImagenResponse2)
  private
  published
  end;


  recibirImagen2 = class(TRemotable)
  private
    Farg0: TByteDynArray;
    Farg0_Specified: boolean;
    Farg1: usuarioWSVO;
    Farg1_Specified: boolean;
    Farg2: imagenWSVO;
    Farg2_Specified: boolean;
    procedure Setarg0(Index: Integer; const ATByteDynArray: TByteDynArray);
    function  arg0_Specified(Index: Integer): boolean;
    procedure Setarg1(Index: Integer; const AusuarioWSVO: usuarioWSVO);
    function  arg1_Specified(Index: Integer): boolean;
    procedure Setarg2(Index: Integer; const AimagenWSVO: imagenWSVO);
    function  arg2_Specified(Index: Integer): boolean;
  public
    destructor Destroy; override;
  published
    property arg0: TByteDynArray  Index (IS_OPTN) read Farg0 write Setarg0 stored arg0_Specified;
    property arg1: usuarioWSVO    Index (IS_OPTN) read Farg1 write Setarg1 stored arg1_Specified;
    property arg2: imagenWSVO     Index (IS_OPTN) read Farg2 write Setarg2 stored arg2_Specified;
  end;


  recibirImagen = class(recibirImagen2)
  private
  published
  end;



  usuarioWSVO = class(TRemotable)
  private
    Fcontrasenia: string;
    Fcontrasenia_Specified: boolean;
    Fidusuario: string;
    Fidusuario_Specified: boolean;
    procedure Setcontrasenia(Index: Integer; const Astring: string);
    function  contrasenia_Specified(Index: Integer): boolean;
    procedure Setidusuario(Index: Integer; const Astring: string);
    function  idusuario_Specified(Index: Integer): boolean;
  published
    property contrasenia: string  Index (IS_OPTN) read Fcontrasenia write Setcontrasenia stored contrasenia_Specified;
    property idusuario:   string  Index (IS_OPTN) read Fidusuario write Setidusuario stored idusuario_Specified;
  end;


  respuestaWSVO = class(TRemotable)
  private
    Ffecha: string;
    Ffecha_Specified: boolean;
    Fresultado: string;
    Fresultado_Specified: boolean;
    Ftipomensaje: string;
    Ftipomensaje_Specified: boolean;
    procedure Setfecha(Index: Integer; const Astring: string);
    function  fecha_Specified(Index: Integer): boolean;
    procedure Setresultado(Index: Integer; const Astring: string);
    function  resultado_Specified(Index: Integer): boolean;
    procedure Settipomensaje(Index: Integer; const Astring: string);
    function  tipomensaje_Specified(Index: Integer): boolean;
  published
    property fecha:       string  Index (IS_OPTN) read Ffecha write Setfecha stored fecha_Specified;
    property resultado:   string  Index (IS_OPTN) read Fresultado write Setresultado stored resultado_Specified;
    property tipomensaje: string  Index (IS_OPTN) read Ftipomensaje write Settipomensaje stored tipomensaje_Specified;
  end;


  imagenWSVO = class(TRemotable)
  private
    Fid_avaluo: string;
    Fid_avaluo_Specified: boolean;
    Fid_imagen: Integer;
    Fobservaciones: string;
    Fobservaciones_Specified: boolean;
    Fpie_foto: string;
    Fpie_foto_Specified: boolean;
    procedure Setid_avaluo(Index: Integer; const Astring: string);
    function  id_avaluo_Specified(Index: Integer): boolean;
    procedure Setobservaciones(Index: Integer; const Astring: string);
    function  observaciones_Specified(Index: Integer): boolean;
    procedure Setpie_foto(Index: Integer; const Astring: string);
    function  pie_foto_Specified(Index: Integer): boolean;
  published
    property id_avaluo:     string   Index (IS_OPTN) read Fid_avaluo write Setid_avaluo stored id_avaluo_Specified;
    property id_imagen:     Integer  read Fid_imagen write Fid_imagen;
    property observaciones: string   Index (IS_OPTN) read Fobservaciones write Setobservaciones stored observaciones_Specified;
    property pie_foto:      string   Index (IS_OPTN) read Fpie_foto write Setpie_foto stored pie_foto_Specified;
  end;

De esta forma es como intento asignarle los valores a usuarioWSVO y imagenWSVO.
Código Delphi [-]
var nUsuarioVO:usuarioWSVO;
    nImagenVO :imagenWSVO;
    nImagenArray :TByteDynArray;
    nRecibirParametros:recibirImagen;
    nRecibe: ReceptorImagenesDelegate;
...
begin

    nUsuarioVO.idusuario   := 'UsuarioPrueba';
    nUsuarioVO.contrasenia := 'Prueba99';

    nImagenVO.Id_Avaluo := '1111111';
    ...
    nImagenArray := FileToByteArray(cArchivo);
    nRecibe := GetReceptorImagenesDelegate(False,'',HTTPRIO1);
    nRecibirParametros.arg0 := nImagenArray;
    nRecibirParametros.arg1 := nUsuarioVO;
    nRecibirParametros.arg2 := nImagenVO;

    nRecibe.recibirImagen(nRecibirParametros);

Al hacer eso me da error "Access Violation at Address..." desde que le asigno el primer valor(nUsuarioVO.idusuario := 'UsuarioPrueba', tengo entendido que es porque no estoy inicializando algún array, quizá esté equivocado, ya estuve viendo varios hilos aquí y no me ha funcionado ya que son diferentes los .pas de otros webservices.

Espero me puedan ayudar ya que de tanto que le he buscado me confundí demasiado.

De antemano muchas gracias.
Responder Con Cita