Luego de obtener esa fecha, debo llamar a otro ws que sigue a continuacion. Es para obtener cotizaciones de las monedas extranjeras a esa fecha.
Me interesa solo la cotizacion del Dolar, pero no me doy cuenta si hay que pasarle algo como parametro ( y como ), o si retorna todas las monedas que retorna el ws.
Muchisimas gracias.. me salvan la vida...
El codigo del ws es este.
Código Delphi
[-]unit u_ws_cotizaciones;
interface
uses Soap.InvokeRegistry, Soap.SOAPHTTPClient, System.Types, Soap.XSBuiltIns;
const
IS_OPTN = $0001;
IS_UNBD = $0002;
IS_NLBL = $0004;
IS_REF = $0080;
type
wsbcucotizaciones_ExecuteResponse = class;
wsbcucotizaciones_Execute = class;
wsbcucotizacionesout = class;
wsbcucotizacionesin = class;
respuestastatus = class;
datoscotizaciones_dato = class;
datoscotizaciones = array of datoscotizaciones_dato;
wsbcucotizaciones_ExecuteResponse = class(TRemotable)
private
FSalida: wsbcucotizacionesout;
public
constructor Create; override;
destructor Destroy; override;
published
property Salida: wsbcucotizacionesout read FSalida write FSalida;
end;
wsbcucotizaciones_Execute = class(TRemotable)
private
FEntrada: wsbcucotizacionesin;
public
constructor Create; override;
destructor Destroy; override;
published
property Entrada: wsbcucotizacionesin read FEntrada write FEntrada;
end;
wsbcucotizacionesout = class(TRemotable)
private
Frespuestastatus: respuestastatus;
Fdatoscotizaciones: datoscotizaciones;
public
destructor Destroy; override;
published
property respuestastatus: respuestastatus read Frespuestastatus write Frespuestastatus;
property datoscotizaciones: datoscotizaciones read Fdatoscotizaciones write Fdatoscotizaciones;
end;
ArrayOfint = array of SmallInt;
wsbcucotizacionesin = class(TRemotable)
private
FMoneda: ArrayOfint;
FFechaDesde: TXSDate;
FFechaHasta: TXSDate;
FGrupo: ShortInt;
public
destructor Destroy; override;
published
property Moneda: ArrayOfint read FMoneda write FMoneda;
property FechaDesde: TXSDate Index (IS_NLBL) read FFechaDesde write FFechaDesde;
property FechaHasta: TXSDate Index (IS_NLBL) read FFechaHasta write FFechaHasta;
property Grupo: ShortInt read FGrupo write FGrupo;
end;
respuestastatus = class(TRemotable)
private
Fstatus: ShortInt;
Fcodigoerror: SmallInt;
Fmensaje: string;
published
property status: ShortInt read Fstatus write Fstatus;
property codigoerror: SmallInt read Fcodigoerror write Fcodigoerror;
property mensaje: string read Fmensaje write Fmensaje;
end;
datoscotizaciones_dato = class(TRemotable)
private
FFecha: TXSDate;
FMoneda: SmallInt;
FNombre: string;
FCodigoISO: string;
FEmisor: string;
FTCC: Double;
FTCV: Double;
FArbAct: Double;
FFormaArbitrar: ShortInt;
public
destructor Destroy; override;
published
property Fecha: TXSDate Index (IS_NLBL) read FFecha write FFecha;
property Moneda: SmallInt read FMoneda write FMoneda;
property Nombre: string read FNombre write FNombre;
property CodigoISO: string read FCodigoISO write FCodigoISO;
property Emisor: string read FEmisor write FEmisor;
property TCC: Double read FTCC write FTCC;
property TCV: Double read FTCV write FTCV;
property ArbAct: Double read FArbAct write FArbAct;
property FormaArbitrar: ShortInt read FFormaArbitrar write FFormaArbitrar;
end;
wsbcucotizacionesSoapPort = interface(IInvokable)
['{FB29A9D1-0AD1-E614-EF96-5E020C189B50}']
function Execute(const parameters: wsbcucotizaciones_Execute): wsbcucotizaciones_ExecuteResponse; stdcall;
end;
function GetwsbcucotizacionesSoapPort(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): wsbcucotizacionesSoapPort;
implementation
uses System.SysUtils;
function GetwsbcucotizacionesSoapPort(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): wsbcucotizacionesSoapPort;
const
defWSDL = 'https://cotizaciones.bcu.gub.uy/wscotizaciones/servlet/awsbcucotizaciones?wsdl';
defURL = 'https://cotizaciones.bcu.gub.uy/wscotizaciones/servlet/awsbcucotizaciones';
defSvc = 'wsbcucotizaciones';
defPrt = 'wsbcucotizacionesSoapPort';
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 wsbcucotizacionesSoapPort);
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 wsbcucotizaciones_ExecuteResponse.Create;
begin
inherited Create;
FSerializationOptions := [xoLiteralParam];
end;
destructor wsbcucotizaciones_ExecuteResponse.Destroy;
begin
System.SysUtils.FreeAndNil(FSalida);
inherited Destroy;
end;
constructor wsbcucotizaciones_Execute.Create;
begin
inherited Create;
FSerializationOptions := [xoLiteralParam];
end;
destructor wsbcucotizaciones_Execute.Destroy;
begin
System.SysUtils.FreeAndNil(FEntrada);
inherited Destroy;
end;
destructor wsbcucotizacionesout.Destroy;
var
I: Integer;
begin
for I := 0 to System.Length(Fdatoscotizaciones)-1 do
System.SysUtils.FreeAndNil(Fdatoscotizaciones[i]);
System.SetLength(Fdatoscotizaciones, 0);
System.SysUtils.FreeAndNil(Frespuestastatus);
inherited Destroy;
end;
destructor wsbcucotizacionesin.Destroy;
begin
System.SysUtils.FreeAndNil(FFechaDesde);
System.SysUtils.FreeAndNil(FFechaHasta);
inherited Destroy;
end;
destructor datoscotizaciones_dato.Destroy;
begin
System.SysUtils.FreeAndNil(FFecha);
inherited Destroy;
end;
initialization
InvRegistry.RegisterInterface(TypeInfo(wsbcucotizacionesSoapPort), 'Cotiza', 'utf-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(wsbcucotizacionesSoapPort), 'Cotizaaction/AWSBCUCOTIZACIONES.Execute');
InvRegistry.RegisterInvokeOptions(TypeInfo(wsbcucotizacionesSoapPort), ioDocument);
InvRegistry.RegisterInvokeOptions(TypeInfo(wsbcucotizacionesSoapPort), ioLiteral);
RemClassRegistry.RegisterXSInfo(TypeInfo(datoscotizaciones), 'Cotiza', 'datoscotizaciones');
RemClassRegistry.RegisterXSClass(wsbcucotizaciones_ExecuteResponse, 'Cotiza', 'wsbcucotizaciones_ExecuteResponse', 'wsbcucotizaciones.ExecuteResponse');
RemClassRegistry.RegisterSerializeOptions(wsbcucotizaciones_ExecuteResponse, [xoLiteralParam]);
RemClassRegistry.RegisterXSClass(wsbcucotizaciones_Execute, 'Cotiza', 'wsbcucotizaciones_Execute', 'wsbcucotizaciones.Execute');
RemClassRegistry.RegisterSerializeOptions(wsbcucotizaciones_Execute, [xoLiteralParam]);
RemClassRegistry.RegisterXSClass(wsbcucotizacionesout, 'Cotiza', 'wsbcucotizacionesout');
RemClassRegistry.RegisterExternalPropName(TypeInfo(wsbcucotizacionesout), 'datoscotizaciones', '[ArrayItemName="datoscotizaciones.dato"]');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfint), 'Cotiza', 'ArrayOfint');
RemClassRegistry.RegisterXSClass(wsbcucotizacionesin, 'Cotiza', 'wsbcucotizacionesin');
RemClassRegistry.RegisterExternalPropName(TypeInfo(wsbcucotizacionesin), 'Moneda', '[ArrayItemName="item"]');
RemClassRegistry.RegisterXSClass(respuestastatus, 'Cotiza', 'respuestastatus');
RemClassRegistry.RegisterXSClass(datoscotizaciones_dato, 'Cotiza', 'datoscotizaciones_dato', 'datoscotizaciones.dato');
end.