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 14-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
Question Obtener fecha de un web service soap

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

  // ************************************************************************ //
  // 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.
  // ************************************************************************ //
  // !:date            - "http://www.w3.org/2001/XMLSchema"[Gbl]

  wsultimocierre_Execute = class;               { "Cotiza"[Lit][GblElm] }
  wsultimocierre_ExecuteResponse = class;       { "Cotiza"[Lit][GblElm] }
  wsultimocierreout    = class;                 { "Cotiza"[GblCplx] }



  // ************************************************************************ //
  // XML       : wsultimocierre.Execute, global, 
  // Namespace : Cotiza
  // Serializtn: [xoLiteralParam]
  // Info      : Wrapper
  // ************************************************************************ //
  wsultimocierre_Execute = class(TRemotable)
  private
  public
    constructor Create; override;
  published
  end;



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



  // ************************************************************************ //
  // XML       : wsultimocierreout, global, 
  // Namespace : Cotiza
  // ************************************************************************ //
  wsultimocierreout = class(TRemotable)
  private
    FFecha: TXSDate;
  public
    destructor Destroy; override;
  published
    property Fecha: TXSDate  Index (IS_NLBL) read FFecha write FFecha;
  end;


  // ************************************************************************ //
  // Namespace : Cotiza
  // soapAction: Cotizaaction/AWSULTIMOCIERRE.Execute
  // transport : http://schemas.xmlsoap.org/soap/http
  // style     : document
  // use       : literal
  // binding   : wsultimocierreSoapBinding
  // service   : wsultimocierre
  // port      : wsultimocierreSoapPort
  // URL       : https://cotizaciones.bcu.gub.uy/wsco...wsultimocierre
  // ************************************************************************ //
  wsultimocierreSoapPort = interface(IInvokable)
  ['{1F3D904F-D18B-D7CE-768C-C23931858A2E}']

    // Cannot unwrap: 
    //     - Input element wrapper name does not match operation's name
    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
  { wsultimocierreSoapPort }
  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;
//    dFecha := ??????

Muchas gracias de antemano por su colabaracion..

Saludos
Responder Con Cita
  #2  
Antiguo 15-12-2020
Avatar de ElKurgan
[ElKurgan] ElKurgan is offline
Miembro Premium
 
Registrado: nov 2005
Posts: 1.234
Poder: 20
ElKurgan Va camino a la fama
Hola, Ibidi.

Lo primero que tienes que hacer es definir la fecha correctamente. Como en el web service está definida asi:

Código Delphi [-]
 wsultimocierreout = class(TRemotable)
  private
    FFecha: TXSDate;
  public
    destructor Destroy; override;
  published
    property Fecha: TXSDate  Index (IS_NLBL) read FFecha write FFecha;
  end;

Tendrás que definirla en Delphi también como:

Código Delphi [-]
dFecha : TXSDate;

Ahora bien, GetwsultimocierreSoapPort devuelve un wsultimocierreSoapPort (tu variable ws_cierre) que tiene una función execute, con un parámetro de tipo wsultimocierre_Execute, que devuelve un tipo wsultimocierre_ExecuteResponse, que tiene una propiedad Salida de tipo wsultimocierreout y este a su vez es el que tiene la propiedad Fecha, creo que al final debería ser más o menos así:

Código Delphi [-]
var
  dFecha : TXSDate;
  ws_cierre : wsultimocierreSoapPort;
  ws_cierre_exe: wsultimocierre_Execute;
  ws_cierre_resp: wsultimocierre_ExecuteResponse;
  ws_ultimo_cierre: wsultimocierreout ;
..
..
  ws_cierre := GetwsultimocierreSoapPort;
  ws_cierre_exe := wsultimocierre_Execute.Create;
  ws_cierre_resp := ws_cierre.Execute(ws_cierre_Exe);
  ws_ultimo_cierre := ws_cierre_resp.Salida;

  dFecha := ws_ultimo_cierre.Fecha;

Creo que más o menos sería así, pero tengo algo oxidado el acceso a webservices en Delphi (como otros muchos males del mundo, ahora estoy con Java por necesidad), pero creo que puede orientarte un poco

Saludos
Responder Con Cita
  #3  
Antiguo 15-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.275
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
Un código como este debería ser suficiente:

Código Delphi [-]
var
  ws_cierre:    wsultimocierreSoapPort;
  ws_out:       wsultimocierreout;
begin
  ws_cierre := GetwsultimocierreSoapPort;
  ws_out := ws_cierre.Execute(wsultimocierre_Execute.Create).Salida;
  ShowMessage('Último cierre: ' + DateToStr(ws_out.Fecha.AsDate));



El tipo TXSDate está defindo en la unit Soap.XSBuiltIns
http://docwiki.embarcadero.com/Libra...iltIns.TXSDate
__________________
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
  #4  
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
MUCHISIMAS GRACIAS a ambos !!

Funciono perfecto de ambas maneras.

Ahora sigo en otra pregunta , porque van ambas concatenadas.
Responder Con Cita
  #5  
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
  #6  
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.275
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
  #7  
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
  #8  
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.275
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
  #9  
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.275
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
  #10  
Antiguo 21-12-2020
Avatar de ElKurgan
[ElKurgan] ElKurgan is offline
Miembro Premium
 
Registrado: nov 2005
Posts: 1.234
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
  #11  
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
  #12  
Antiguo 04-01-2021
Avatar de lbidi
lbidi lbidi is offline
Miembro
 
Registrado: oct 2003
Ubicación: Montevideo- URUGUAY
Posts: 417
Poder: 21
lbidi Va por buen camino
FELIZ AÑO PARA TODOS LOS FORISTAS !!!

Estimados, vuelvo a molestar para preguntar porque puede ser que estos webservices que tan bien German ayudo a que me funcionara,
no se ejecute bien en Windows 7 y funcione perfecto en WIN 10 ??

Solamente me dice que no se pudo establecer comunicacion con el servidor..
Responder Con Cita
  #13  
Antiguo 11-01-2021
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.275
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
Me da la impresión de que tiene que ver con los protocolos de comunicación.
Lo primero es analizarlo utilizando la web: https://www.ssllabs.com/ssltest/

Accede a la web y analiza tu servidor: https://cotizaciones.bcu.gub.uy/wscotizaciones/servlet/

Luego, aplicando esto que tienes aquí, ya sea mediante los parches o creando las claves del registro, te debería funcionar.
Yo he conseguido que desaparezca el error y acced sin problemas.
https://support.microsoft.com/en-us/...rotocols-in-wi

Revisa también este bug. Ahí hay soluciones que te ayudarán:
https://quality.embarcadero.com/browse/RSP-31406
__________________
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.

Última edición por Neftali [Germán.Estévez] fecha: 20-01-2021 a las 09:05:42.
Responder Con Cita
  #14  
Antiguo 19-01-2021
Avatar de lbidi
lbidi lbidi is offline
Miembro
 
Registrado: oct 2003
Ubicación: Montevideo- URUGUAY
Posts: 417
Poder: 21
lbidi Va por buen camino
Muchas gracias German.

Aun no he podido probarlo en un pc con W7 pero apenas pueda, comento como me fue.

Saludos !!
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 09:02:27.


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