Ver Mensaje Individual
  #1  
Antiguo 14-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
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