Ver Mensaje Individual
  #5  
Antiguo 15-12-2020
Avatar de lbidi
lbidi lbidi is offline
Miembro
 
Registrado: oct 2003
Ubicación: Montevideo- URUGUAY
Posts: 417
Reputación: 21
lbidi Va por buen camino
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

  // ************************************************************************ //
  // The following types, referred to in the WSDL document are not being represented
  // in this file. They are either aliases[@] of other types represented or were referred
  // to but never[!] declared in the document. The types from the latter category
  // typically map to predefined/known XML or Embarcadero types; however, they could also 
  // indicate incorrect WSDL documents that failed to declare or import a schema type.
  // ************************************************************************ //
  // !:string          - "http://www.w3.org/2001/XMLSchema"[Gbl]
  // !:double          - "http://www.w3.org/2001/XMLSchema"[Gbl]
  // !:date            - "http://www.w3.org/2001/XMLSchema"[Gbl]
  // !:short           - "http://www.w3.org/2001/XMLSchema"[Gbl]
  // !:byte            - "http://www.w3.org/2001/XMLSchema"[Gbl]

  wsbcucotizaciones_ExecuteResponse = class;    { "Cotiza"[Lit][GblElm] }
  wsbcucotizaciones_Execute = class;            { "Cotiza"[Lit][GblElm] }
  wsbcucotizacionesout = class;                 { "Cotiza"[GblCplx] }
  wsbcucotizacionesin  = class;                 { "Cotiza"[GblCplx] }
  respuestastatus      = class;                 { "Cotiza"[GblCplx] }
  datoscotizaciones_dato = class;               { "Cotiza"[GblCplx] }

  datoscotizaciones = array of datoscotizaciones_dato;   { "Cotiza"[GblCplx] }


  // ************************************************************************ //
  // XML       : wsbcucotizaciones.ExecuteResponse, global, 
  // Namespace : Cotiza
  // Serializtn: [xoLiteralParam]
  // Info      : Wrapper
  // ************************************************************************ //
  wsbcucotizaciones_ExecuteResponse = class(TRemotable)
  private
    FSalida: wsbcucotizacionesout;
  public
    constructor Create; override;
    destructor Destroy; override;
  published
    property Salida: wsbcucotizacionesout  read FSalida write FSalida;
  end;



  // ************************************************************************ //
  // XML       : wsbcucotizaciones.Execute, global, 
  // Namespace : Cotiza
  // Serializtn: [xoLiteralParam]
  // Info      : Wrapper
  // ************************************************************************ //
  wsbcucotizaciones_Execute = class(TRemotable)
  private
    FEntrada: wsbcucotizacionesin;
  public
    constructor Create; override;
    destructor Destroy; override;
  published
    property Entrada: wsbcucotizacionesin  read FEntrada write FEntrada;
  end;



  // ************************************************************************ //
  // XML       : wsbcucotizacionesout, global, 
  // Namespace : Cotiza
  // ************************************************************************ //
  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;               { "Cotiza"[GblCplx] }


  // ************************************************************************ //
  // XML       : wsbcucotizacionesin, global, 
  // Namespace : Cotiza
  // ************************************************************************ //
  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;



  // ************************************************************************ //
  // XML       : respuestastatus, global, 
  // Namespace : Cotiza
  // ************************************************************************ //
  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;



  // ************************************************************************ //
  // XML       : datoscotizaciones.dato, global, 
  // Namespace : Cotiza
  // ************************************************************************ //
  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;


  // ************************************************************************ //
  // Namespace : Cotiza
  // soapAction: Cotizaaction/AWSBCUCOTIZACIONES.Execute
  // transport : http://schemas.xmlsoap.org/soap/http
  // style     : document
  // use       : literal
  // binding   : wsbcucotizacionesSoapBinding
  // service   : wsbcucotizaciones
  // port      : wsbcucotizacionesSoapPort
  // URL       : https://cotizaciones.bcu.gub.uy/wsco...cucotizaciones
  // ************************************************************************ //
  wsbcucotizacionesSoapPort = interface(IInvokable)
  ['{FB29A9D1-0AD1-E614-EF96-5E020C189B50}']

    // Cannot unwrap: 
    //     - Input element wrapper name does not match operation's name
    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
  { wsbcucotizacionesSoapPort }
  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.
Responder Con Cita