Cita:
Empezado por giulichajari
Estas tratando de acceder a un objeto que no existe...
Debes hacer:
Código Delphi [-]nombredelservicio.nUsuarioVO.Create;
esto antes de los parametros obviamente.
Lo mismo para los otras clases remotables debes crear un objeto
|
Es correcto, ya puede llenar los datos de todos los parametros y no me da error hasta que intento hacer la llamada al webservice, quizá también me falte crear otro objeto antes de la llamada pero sigo un tanto confundido porque ya creé los que tenían en mente que se iban a usar y me da el mismo error de "Access Violation at Address...", mi declaración para hacer la llamada es la siguiente
Código Delphi
[-]
Var
...
nResponse :recibirImagenResponse;
nRespuestaWS : respuestaWSVO;
begin
...
nRecibe := GetReceptorImagenesDelegate(False,'',HTTPRIO1);
nResponse:= nRecibe.recibirImagen(nParametros);
...
El wsdl lo importé en Delphi XE5 y me generó el .pas, me copié el código y lo estoy usando en un Delphi 6 pero les menciono que tuve un detalle con dos lineas que se encuentran casi al final del archivo las cuales deshabilité para que me compilara sin error, son las siguientes:
Código Delphi
[-]
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(ReceptorImagenesDelegate), '');
InvRegistry.RegisterInvokeOptions(TypeInfo(ReceptorImagenesDelegate), ioSOAP12);
Aquí dejaré el código completo del archivo .pas que me generó al importar el wsdl...
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;
ReceptorImagenesDelegate = interface(IInvokable)
['{330CA768-A8D8-7967-025E-AFA4E47995DC}']
function recibirImagen(const parameters: recibirImagen): recibirImagenResponse; stdcall;
end;
function GetReceptorImagenesDelegate(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): ReceptorImagenesDelegate;
implementation
uses SysUtils;
function GetReceptorImagenesDelegate(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): ReceptorImagenesDelegate;
const
defWSDL = 'http://201.144.89.12/recepcionImagenesWS/ReceptorImagenesService/WEB-INF/wsdl/ReceptorImagenesService.wsdl';
defURL = '';
defSvc = 'ReceptorImagenesService';
defPrt = 'ReceptorImagenesPort';
var
RIO: THTTPRIO;
begin
Result := nil;
if (Addr = '') then
begin
if UseWSDL then
Addr := defWSDL
else
Addr := defURL;
end;
if HTTPRIO = nil then
RIO := THTTPRIO.Create(nil)
else
RIO := HTTPRIO;
try
Result := (RIO as ReceptorImagenesDelegate);
if UseWSDL then
begin
RIO.WSDLLocation := Addr;
RIO.Service := defSvc;
RIO.Port := defPrt;
end else
RIO.URL := Addr;
finally
if (Result = nil) and (HTTPRIO = nil) then
RIO.Free;
end;
end;
destructor recibirImagenResponse2.Destroy;
begin
SysUtils.FreeAndNil(Freturn);
inherited Destroy;
end;
procedure recibirImagenResponse2.Setreturn(Index: Integer; const ArespuestaWSVO: respuestaWSVO);
begin
Freturn := ArespuestaWSVO;
Freturn_Specified := True;
end;
function recibirImagenResponse2.return_Specified(Index: Integer): boolean;
begin
Result := Freturn_Specified;
end;
destructor recibirImagen2.Destroy;
begin
SysUtils.FreeAndNil(Farg1);
SysUtils.FreeAndNil(Farg2);
inherited Destroy;
end;
procedure recibirImagen2.Setarg0(Index: Integer; const ATByteDynArray: TByteDynArray);
begin
Farg0 := ATByteDynArray;
Farg0_Specified := True;
end;
function recibirImagen2.arg0_Specified(Index: Integer): boolean;
begin
Result := Farg0_Specified;
end;
procedure recibirImagen2.Setarg1(Index: Integer; const AusuarioWSVO: usuarioWSVO);
begin
Farg1 := AusuarioWSVO;
Farg1_Specified := True;
end;
function recibirImagen2.arg1_Specified(Index: Integer): boolean;
begin
Result := Farg1_Specified;
end;
procedure recibirImagen2.Setarg2(Index: Integer; const AimagenWSVO: imagenWSVO);
begin
Farg2 := AimagenWSVO;
Farg2_Specified := True;
end;
function recibirImagen2.arg2_Specified(Index: Integer): boolean;
begin
Result := Farg2_Specified;
end;
procedure usuarioWSVO.Setcontrasenia(Index: Integer; const Astring: string);
begin
Fcontrasenia := Astring;
Fcontrasenia_Specified := True;
end;
function usuarioWSVO.contrasenia_Specified(Index: Integer): boolean;
begin
Result := Fcontrasenia_Specified;
end;
procedure usuarioWSVO.Setidusuario(Index: Integer; const Astring: string);
begin
Fidusuario := Astring;
Fidusuario_Specified := True;
end;
function usuarioWSVO.idusuario_Specified(Index: Integer): boolean;
begin
Result := Fidusuario_Specified;
end;
procedure respuestaWSVO.Setfecha(Index: Integer; const Astring: string);
begin
Ffecha := Astring;
Ffecha_Specified := True;
end;
function respuestaWSVO.fecha_Specified(Index: Integer): boolean;
begin
Result := Ffecha_Specified;
end;
procedure respuestaWSVO.Setresultado(Index: Integer; const Astring: string);
begin
Fresultado := Astring;
Fresultado_Specified := True;
end;
function respuestaWSVO.resultado_Specified(Index: Integer): boolean;
begin
Result := Fresultado_Specified;
end;
procedure respuestaWSVO.Settipomensaje(Index: Integer; const Astring: string);
begin
Ftipomensaje := Astring;
Ftipomensaje_Specified := True;
end;
function respuestaWSVO.tipomensaje_Specified(Index: Integer): boolean;
begin
Result := Ftipomensaje_Specified;
end;
procedure imagenWSVO.Setid_avaluo(Index: Integer; const Astring: string);
begin
Fid_avaluo := Astring;
Fid_avaluo_Specified := True;
end;
function imagenWSVO.id_avaluo_Specified(Index: Integer): boolean;
begin
Result := Fid_avaluo_Specified;
end;
procedure imagenWSVO.Setobservaciones(Index: Integer; const Astring: string);
begin
Fobservaciones := Astring;
Fobservaciones_Specified := True;
end;
function imagenWSVO.observaciones_Specified(Index: Integer): boolean;
begin
Result := Fobservaciones_Specified;
end;
procedure imagenWSVO.Setpie_foto(Index: Integer; const Astring: string);
begin
Fpie_foto := Astring;
Fpie_foto_Specified := True;
end;
function imagenWSVO.pie_foto_Specified(Index: Integer): boolean;
begin
Result := Fpie_foto_Specified;
end;
initialization
InvRegistry.RegisterInterface(TypeInfo(ReceptorImagenesDelegate), 'http://receptorImagenes.servicios.business.avaluos.infonavit.org.mx/', 'UTF-8');
RemClassRegistry.RegisterXSClass(recibirImagenResponse2, 'http://receptorImagenes.servicios.business.avaluos.infonavit.org.mx/', 'recibirImagenResponse2', 'recibirImagenResponse');
RemClassRegistry.RegisterXSClass(recibirImagenResponse, 'http://receptorImagenes.servicios.business.avaluos.infonavit.org.mx/', 'recibirImagenResponse');
RemClassRegistry.RegisterXSClass(recibirImagen2, 'http://receptorImagenes.servicios.business.avaluos.infonavit.org.mx/', 'recibirImagen2', 'recibirImagen');
RemClassRegistry.RegisterXSClass(recibirImagen, 'http://receptorImagenes.servicios.business.avaluos.infonavit.org.mx/', 'recibirImagen');
RemClassRegistry.RegisterXSClass(usuarioWSVO, 'http://receptorImagenes.servicios.business.avaluos.infonavit.org.mx/', 'usuarioWSVO');
RemClassRegistry.RegisterXSClass(respuestaWSVO, 'http://receptorImagenes.servicios.business.avaluos.infonavit.org.mx/', 'respuestaWSVO');
RemClassRegistry.RegisterXSClass(imagenWSVO, 'http://receptorImagenes.servicios.business.avaluos.infonavit.org.mx/', 'imagenWSVO');
end.
Gracias por el tiempo que se toman en responder, saludos.