Estimados.. Recurro a uds luego de un dia tratando de encontrar el problema( pero en realidad, el problema soy yo, que no se aun utilizar muy bien las clases y los web services ).
Necesito obtener una fecha resultado del wbs que presento a continuacion.
El problema es que no estoy muy seguro como instanciarlo, ejecutarlo y obtener el resultado.
El wbs es el siguiente
Código Delphi
[-]unit u_ws_ultimo_cierre;
interface
uses Soap.InvokeRegistry, Soap.SOAPHTTPClient, System.Types, Soap.XSBuiltIns;
const
IS_NLBL = $0004;
IS_REF = $0080;
type
wsultimocierre_Execute = class;
wsultimocierre_ExecuteResponse = class;
wsultimocierreout = class;
wsultimocierre_Execute = class(TRemotable)
private
public
constructor Create; override;
published
end;
wsultimocierre_ExecuteResponse = class(TRemotable)
private
FSalida: wsultimocierreout;
public
constructor Create; override;
destructor Destroy; override;
published
property Salida: wsultimocierreout read FSalida write FSalida;
end;
wsultimocierreout = class(TRemotable)
private
FFecha: TXSDate;
public
destructor Destroy; override;
published
property Fecha: TXSDate Index (IS_NLBL) read FFecha write FFecha;
end;
wsultimocierreSoapPort = interface(IInvokable)
['{1F3D904F-D18B-D7CE-768C-C23931858A2E}']
function Execute(const parameters: wsultimocierre_Execute): wsultimocierre_ExecuteResponse; stdcall;
end;
function GetwsultimocierreSoapPort(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): wsultimocierreSoapPort;
implementation
uses System.SysUtils;
function GetwsultimocierreSoapPort(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): wsultimocierreSoapPort;
const
defWSDL = 'https://cotizaciones.bcu.gub.uy/wscotizaciones/servlet/awsultimocierre?wsdl';
defURL = 'https://cotizaciones.bcu.gub.uy/wscotizaciones/servlet/awsultimocierre';
defSvc = 'wsultimocierre';
defPrt = 'wsultimocierreSoapPort';
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 wsultimocierreSoapPort);
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;
constructor wsultimocierre_Execute.Create;
begin
inherited Create;
FSerializationOptions := [xoLiteralParam];
end;
constructor wsultimocierre_ExecuteResponse.Create;
begin
inherited Create;
FSerializationOptions := [xoLiteralParam];
end;
destructor wsultimocierre_ExecuteResponse.Destroy;
begin
System.SysUtils.FreeAndNil(FSalida);
inherited Destroy;
end;
destructor wsultimocierreout.Destroy;
begin
System.SysUtils.FreeAndNil(FFecha);
inherited Destroy;
end;
initialization
InvRegistry.RegisterInterface(TypeInfo(wsultimocierreSoapPort), 'Cotiza', 'utf-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(wsultimocierreSoapPort), 'Cotizaaction/AWSULTIMOCIERRE.Execute');
InvRegistry.RegisterInvokeOptions(TypeInfo(wsultimocierreSoapPort), ioDocument);
InvRegistry.RegisterInvokeOptions(TypeInfo(wsultimocierreSoapPort), ioLiteral);
RemClassRegistry.RegisterXSClass(wsultimocierre_Execute, 'Cotiza', 'wsultimocierre_Execute', 'wsultimocierre.Execute');
RemClassRegistry.RegisterSerializeOptions(wsultimocierre_Execute, [xoLiteralParam]);
RemClassRegistry.RegisterXSClass(wsultimocierre_ExecuteResponse, 'Cotiza', 'wsultimocierre_ExecuteResponse', 'wsultimocierre.ExecuteResponse');
RemClassRegistry.RegisterSerializeOptions(wsultimocierre_ExecuteResponse, [xoLiteralParam]);
RemClassRegistry.RegisterXSClass(wsultimocierreout, 'Cotiza', 'wsultimocierreout');
end.
Y lo tengo "instanciado" en mi aplicacion de esta manera.
Código Delphi
[-]
dFecha : TDate;
ws_cierre : wsultimocierreSoapPort;
ws_cierre := GetwsultimocierreSoapPort;
Muchas gracias de antemano por su colabaracion..
Saludos