Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Internet
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 15-12-2020
Avatar de lbidi
lbidi lbidi is offline
Miembro
 
Registrado: oct 2003
Ubicación: Montevideo- URUGUAY
Posts: 417
Poder: 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
  #2  
Antiguo 16-12-2020
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - España
Posts: 18.290
Poder: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
Revisando por encima, parece que wsbcucotizacionesin, debes asignarlo tú.
De todas formas, para no estar probando, deberías buscar si hay documentación.
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Responder Con Cita
  #3  
Antiguo 17-12-2020
Avatar de lbidi
lbidi lbidi is offline
Miembro
 
Registrado: oct 2003
Ubicación: Montevideo- URUGUAY
Posts: 417
Poder: 21
lbidi Va por buen camino
Gracias German por responder. He estado buscando informacion pero al ser un organismo del estado, no esta tan facil de encontrar si hubiera, por eso
fue que puse el post original .

No tengo ni idea como hacer lo que me pides, pero ya vere.. habra que ir tanteando como se hace, a prueba y error.

Saludos
Responder Con Cita
  #4  
Antiguo 18-12-2020
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - España
Posts: 18.290
Poder: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
Cita:
Empezado por lbidi Ver Mensaje
No tengo ni idea como hacer lo que me pides, pero ya vere.. habra que ir tanteando como se hace, a prueba y error.
Al final debes llamar al Execute. A partir de ahí dsebes ir "tirando del hilo" como se suele decir.
El parámetro de entrada es de tipo wsbcucotizaciones_Execute y la salida de tipo wsbcucotizaciones_ExecuteResponse.

Si te centras en la respuesta, tiene una property:

Código Delphi [-]
property Salida: wsbcucotizacionesout  read FSalida write FSalida;

A su vez wsbcucotizacionesout tiene 2 propiedades:

Código Delphi [-]
    property respuestastatus:   respuestastatus    read Frespuestastatus write Frespuestastatus;
    property datoscotizaciones: datoscotizaciones  read Fdatoscotizaciones write Fdatoscotizaciones;


respuestastatus parece por el nombre cómo ha ido la petición y datoscotizaciones es un array del tipo datoscotizaciones_dato, que parece ser lo que tú necesitas:

Código Delphi [-]
    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;

Con el parámetro de entrada debes hacer lo mismo.
wsbcucotizaciones_Execute tiene una propiedad:

Código Delphi [-]
    property Entrada: wsbcucotizacionesin  read FEntrada write FEntrada;

Y el tipo wsbcucotizacionesin tiene la siguiente estructura:

Código Delphi [-]
    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;

Tiene sentido, que para solicittar una cotización debas añadir unas fechas y una moneda. El Grupo, ya no se que es.
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Responder Con Cita
  #5  
Antiguo 18-12-2020
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - España
Posts: 18.290
Poder: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
No es muy complicado.
Un código como este conecta y devuelve resultados:

Código Delphi [-]
var
  wsSoapPort: wsbcucotizacionesSoapPort;
  ws_out: wsbcucotizacionesout;
  p: wsbcucotizaciones_Execute;
  Monedas: ArrayOfint;
begin
  wsSoapPort := GetwsbcucotizacionesSoapPort();

  p := wsbcucotizaciones_Execute.Create;
  p.Entrada := wsbcucotizacionesin.Create;
  p.Entrada.FechaDesde := TXSDate.Create;
  p.Entrada.FechaHasta := TXSDate.Create;

  SetLength(Monedas, 1);
  Monedas[0] := 2; // Monedas[2] := 1;

  p.Entrada.Moneda := Monedas;
  p.Entrada.FechaDesde.AsDate := EncodeDate(2020, 12, 01);
  p.Entrada.FechaHasta.AsDate := EncodeDate(2020, 12, 31);

  ws_out := wsSoapPort.Execute(p).Salida;

  ShowMessage('Respuesta: ' + IntToStr(ws_out.respuestastatus.status) + ' - ' +
              IntToStr(ws_out.respuestastatus.codigoerror) + ' - ' +
              ws_out.respuestastatus.mensaje);

  ShowMessage('Número de cotizaciones: ' + IntToStr(Length(ws_out.datoscotizaciones)));

  ShowMessage(
    'Nombre: ' + ws_out.datoscotizaciones[0].Nombre + sLineBreak +
    'CodigoISO: ' + ws_out.datoscotizaciones[0].CodigoISO + sLineBreak +
    'Emisor: ' + ws_out.datoscotizaciones[0].Emisor + sLineBreak +
    'Fecha: ' + DateToStr(ws_out.datoscotizaciones[0].Fecha.AsDate) + sLineBreak +
    'Modeda: ' + IntToStr(ws_out.datoscotizaciones[0].Moneda) + sLineBreak +
    'TCC: ' + FloatToStr(ws_out.datoscotizaciones[0].TCC) + sLineBreak +
    'TCC: ' + FloatToStr(ws_out.datoscotizaciones[0].TCV));

Un código como este devuelve algun resultado con sentido.



Si accedes a la primera:

__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Responder Con Cita
  #6  
Antiguo 21-12-2020
Avatar de ElKurgan
[ElKurgan] ElKurgan is offline
Miembro Premium
 
Registrado: nov 2005
Posts: 1.235
Poder: 20
ElKurgan Va camino a la fama
Wow! Qué gran trabajo, Germán... Yo me había atorado un poco y está todo más que claro...

Gracias y un saludo
Responder Con Cita
  #7  
Antiguo 21-12-2020
Avatar de lbidi
lbidi lbidi is offline
Miembro
 
Registrado: oct 2003
Ubicación: Montevideo- URUGUAY
Posts: 417
Poder: 21
lbidi Va por buen camino
EXCELENTE es poco GERMAN...

Muchisimas gracias !!!

Soy bastante inutil y neofito con respecto a los webservices pero con ese nivel de detalle tuyo , es muy facil de comprender.

Mi mayor estimacion para ti y mi respeto.

Saludos y felicias fiestas ...
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Respuesta multipart de Web Service SOAP alejozd Internet 0 27-06-2018 00:12:19
Web Service SOAP con Delphi 5 socger Internet 7 26-07-2012 22:25:51
SOAP Web Service foetus JAVA 3 19-02-2009 16:50:44
cliente Web service SOAP php papulo PHP 0 13-02-2009 11:41:16
Version SOAP en Web Service D7 Luis Heriberto Internet 0 06-09-2006 00:07:16


La franja horaria es GMT +2. Ahora son las 16:57:23.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi