Ver Mensaje Individual
  #5  
Antiguo 26-07-2022
IVAND IVAND is offline
Miembro
 
Registrado: may 2003
Ubicación: ECUADOR
Posts: 524
Reputación: 22
IVAND Va por buen camino
Hola a todos
Utilizo delphi 2009


uso el import wsl y me genera una unidad
Código Delphi [-]
 AutorizacionComprobantesOffline = interface(IInvokable)
  ['{9454FB2D-D447-50CB-A1BE-8496232441E1}']
    function  autorizacionComprobante(const claveAccesoComprobante: string): respuestaComprobante; stdcall;
    function  autorizacionComprobanteLote(const claveAccesoLote: string): respuestaLote; stdcall;
  end;

Esta me genera unas funciones

pero no se como acceder a ellas he utilizado un programa q se llama SoapUI 5.7.0 el cual coloco la url y me desplega unas opciones justamente es la funcion q le indico autorizacionComprobante -- la cual se debe pasar una clave de acceso (2007202207139187147300120010240000052940000004414) y me tendria q retornar un archivo xml con toda la informacion requerida para luego leer ese archivo y hacer varias cosas pero no se como llamar o donde almacear en resultado de esa funcion

Debo almacenar en un compobente memo

Utilizo ademas un componente HTTPRIO que vi en un manual por ahi q se debe usar junto a algunas funciones que salen ya automaticamente
en port sale esta opcion AutorizacionComprobantesOfflinePort
en service sale AutorizacionComprobantesOfflineService
wsdllocation sale https://cel.sri.gob.ec/comprobantes-...esOffline?wsdl

adjunto archivo para ver si me dan una luz
Código Delphi [-]
// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL     : https://cel.sri.gob.ec/comprobantes-...esOffline?wsdl
//  >Import : https://cel.sri.gob.ec/comprobantes-electronicos-ws/AutorizacionComprobantesOffline?wsdl>0
// Encoding : UTF-8
// Version  : 1.0
// (20/07/2022 18:55:26 - - $Rev: 19514 $)
// ************************************************************************ //

unit AutorizacionComprobantesOffline1;

interface

uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;

const
  IS_OPTN = $0001;
  IS_UNBD = $0002;
  IS_UNQL = $0008;
  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 Borland 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]
  // !:dateTime        - "http://www.w3.org/2001/XMLSchema"[Gbl]

  respuestaComprobante = class;                 { "http://ec.gob.sri.ws.autorizacion"[GblCplx] }
  autorizacion         = class;                 { "http://ec.gob.sri.ws.autorizacion"[GblCplx] }
  autorizacion2        = class;                 { "http://ec.gob.sri.ws.autorizacion"[GblElm] }
  mensaje              = class;                 { "http://ec.gob.sri.ws.autorizacion"[GblCplx] }
  mensaje2             = class;                 { "http://ec.gob.sri.ws.autorizacion"[GblElm] }
  respuestaLote        = class;                 { "http://ec.gob.sri.ws.autorizacion"[GblCplx] }

  autorizaciones = array of autorizacion2;      { "http://ec.gob.sri.ws.autorizacion"[Cplx] }


  // ************************************************************************ //
  // XML       : respuestaComprobante, global, 
  // Namespace : http://ec.gob.sri.ws.autorizacion
  // ************************************************************************ //
  respuestaComprobante = class(TRemotable)
  private
    FclaveAccesoConsultada: string;
    FclaveAccesoConsultada_Specified: boolean;
    FnumeroComprobantes: string;
    FnumeroComprobantes_Specified: boolean;
    Fautorizaciones: autorizaciones;
    Fautorizaciones_Specified: boolean;
    procedure SetclaveAccesoConsultada(Index: Integer; const Astring: string);
    function  claveAccesoConsultada_Specified(Index: Integer): boolean;
    procedure SetnumeroComprobantes(Index: Integer; const Astring: string);
    function  numeroComprobantes_Specified(Index: Integer): boolean;
    procedure Setautorizaciones(Index: Integer; const Aautorizaciones: autorizaciones);
    function  autorizaciones_Specified(Index: Integer): boolean;
  public
    destructor Destroy; override;
  published
    property claveAccesoConsultada: string          Index (IS_OPTN or IS_UNQL) read FclaveAccesoConsultada write SetclaveAccesoConsultada stored claveAccesoConsultada_Specified;
    property numeroComprobantes:    string          Index (IS_OPTN or IS_UNQL) read FnumeroComprobantes write SetnumeroComprobantes stored numeroComprobantes_Specified;
    property autorizaciones:        autorizaciones  Index (IS_OPTN or IS_UNQL) read Fautorizaciones write Setautorizaciones stored autorizaciones_Specified;
  end;

  mensajes   = array of mensaje2;               { "http://ec.gob.sri.ws.autorizacion"[Cplx] }


  // ************************************************************************ //
  // XML       : autorizacion, global, 
  // Namespace : http://ec.gob.sri.ws.autorizacion
  // ************************************************************************ //
  autorizacion = class(TRemotable)
  private
    Festado: string;
    Festado_Specified: boolean;
    FnumeroAutorizacion: string;
    FnumeroAutorizacion_Specified: boolean;
    FfechaAutorizacion: TXSDateTime;
    FfechaAutorizacion_Specified: boolean;
    Fambiente: string;
    Fambiente_Specified: boolean;
    Fcomprobante: string;
    Fcomprobante_Specified: boolean;
    Fmensajes: mensajes;
    Fmensajes_Specified: boolean;
    procedure Setestado(Index: Integer; const Astring: string);
    function  estado_Specified(Index: Integer): boolean;
    procedure SetnumeroAutorizacion(Index: Integer; const Astring: string);
    function  numeroAutorizacion_Specified(Index: Integer): boolean;
    procedure SetfechaAutorizacion(Index: Integer; const ATXSDateTime: TXSDateTime);
    function  fechaAutorizacion_Specified(Index: Integer): boolean;
    procedure Setambiente(Index: Integer; const Astring: string);
    function  ambiente_Specified(Index: Integer): boolean;
    procedure Setcomprobante(Index: Integer; const Astring: string);
    function  comprobante_Specified(Index: Integer): boolean;
    procedure Setmensajes(Index: Integer; const Amensajes: mensajes);
    function  mensajes_Specified(Index: Integer): boolean;
  public
    destructor Destroy; override;
  published
    property estado:             string       Index (IS_OPTN or IS_UNQL) read Festado write Setestado stored estado_Specified;
    property numeroAutorizacion: string       Index (IS_OPTN or IS_UNQL) read FnumeroAutorizacion write SetnumeroAutorizacion stored numeroAutorizacion_Specified;
    property fechaAutorizacion:  TXSDateTime  Index (IS_OPTN or IS_UNQL) read FfechaAutorizacion write SetfechaAutorizacion stored fechaAutorizacion_Specified;
    property ambiente:           string       Index (IS_OPTN or IS_UNQL) read Fambiente write Setambiente stored ambiente_Specified;
    property comprobante:        string       Index (IS_OPTN or IS_UNQL) read Fcomprobante write Setcomprobante stored comprobante_Specified;
    property mensajes:           mensajes     Index (IS_OPTN or IS_UNQL) read Fmensajes write Setmensajes stored mensajes_Specified;
  end;



  // ************************************************************************ //
  // XML       : autorizacion, global, 
  // Namespace : http://ec.gob.sri.ws.autorizacion
  // ************************************************************************ //
  autorizacion2 = class(autorizacion)
  private
  published
  end;



  // ************************************************************************ //
  // XML       : mensaje, global, 
  // Namespace : http://ec.gob.sri.ws.autorizacion
  // ************************************************************************ //
  mensaje = class(TRemotable)
  private
    Fidentificador: string;
    Fidentificador_Specified: boolean;
    Fmensaje: string;
    Fmensaje_Specified: boolean;
    FinformacionAdicional: string;
    FinformacionAdicional_Specified: boolean;
    Ftipo: string;
    Ftipo_Specified: boolean;
    procedure Setidentificador(Index: Integer; const Astring: string);
    function  identificador_Specified(Index: Integer): boolean;
    procedure Setmensaje(Index: Integer; const Astring: string);
    function  mensaje_Specified(Index: Integer): boolean;
    procedure SetinformacionAdicional(Index: Integer; const Astring: string);
    function  informacionAdicional_Specified(Index: Integer): boolean;
    procedure Settipo(Index: Integer; const Astring: string);
    function  tipo_Specified(Index: Integer): boolean;
  published
    property identificador:        string  Index (IS_OPTN or IS_UNQL) read Fidentificador write Setidentificador stored identificador_Specified;
    property mensaje:              string  Index (IS_OPTN or IS_UNQL) read Fmensaje write Setmensaje stored mensaje_Specified;
    property informacionAdicional: string  Index (IS_OPTN or IS_UNQL) read FinformacionAdicional write SetinformacionAdicional stored informacionAdicional_Specified;
    property tipo:                 string  Index (IS_OPTN or IS_UNQL) read Ftipo write Settipo stored tipo_Specified;
  end;



  // ************************************************************************ //
  // XML       : mensaje, global, 
  // Namespace : http://ec.gob.sri.ws.autorizacion
  // ************************************************************************ //
  mensaje2 = class(mensaje)
  private
  published
  end;

  autorizaciones2 = array of autorizacion2;     { "http://ec.gob.sri.ws.autorizacion"[Cplx] }


  // ************************************************************************ //
  // XML       : respuestaLote, global, 
  // Namespace : http://ec.gob.sri.ws.autorizacion
  // ************************************************************************ //
  respuestaLote = class(TRemotable)
  private
    FclaveAccesoLoteConsultada: string;
    FclaveAccesoLoteConsultada_Specified: boolean;
    FnumeroComprobantesLote: string;
    FnumeroComprobantesLote_Specified: boolean;
    Fautorizaciones: autorizaciones2;
    Fautorizaciones_Specified: boolean;
    procedure SetclaveAccesoLoteConsultada(Index: Integer; const Astring: string);
    function  claveAccesoLoteConsultada_Specified(Index: Integer): boolean;
    procedure SetnumeroComprobantesLote(Index: Integer; const Astring: string);
    function  numeroComprobantesLote_Specified(Index: Integer): boolean;
    procedure Setautorizaciones(Index: Integer; const Aautorizaciones2: autorizaciones2);
    function  autorizaciones_Specified(Index: Integer): boolean;
  public
    destructor Destroy; override;
  published
    property claveAccesoLoteConsultada: string           Index (IS_OPTN or IS_UNQL) read FclaveAccesoLoteConsultada write SetclaveAccesoLoteConsultada stored claveAccesoLoteConsultada_Specified;
    property numeroComprobantesLote:    string           Index (IS_OPTN or IS_UNQL) read FnumeroComprobantesLote write SetnumeroComprobantesLote stored numeroComprobantesLote_Specified;
    property autorizaciones:            autorizaciones2  Index (IS_OPTN or IS_UNQL) read Fautorizaciones write Setautorizaciones stored autorizaciones_Specified;
  end;


  // ************************************************************************ //
  // Namespace : http://ec.gob.sri.ws.autorizacion
  // transport : http://schemas.xmlsoap.org/soap/http
  // style     : document
  // binding   : AutorizacionComprobantesOfflineServiceSoapBinding
  // service   : AutorizacionComprobantesOfflineService
  // port      : AutorizacionComprobantesOfflinePort
  // URL       : https://cel.sri.gob.ec/comprobantes-...obantesOffline
  // ************************************************************************ //
  AutorizacionComprobantesOffline = interface(IInvokable)
  ['{9454FB2D-D447-50CB-A1BE-8496232441E1}']
    function  autorizacionComprobante(const claveAccesoComprobante: string): respuestaComprobante; stdcall;
    function  autorizacionComprobanteLote(const claveAccesoLote: string): respuestaLote; stdcall;
  end;

function GetAutorizacionComprobantesOffline(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): AutorizacionComprobantesOffline;


implementation
  uses SysUtils;

function GetAutorizacionComprobantesOffline(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): AutorizacionComprobantesOffline;
const
  defWSDL = 'https://cel.sri.gob.ec/comprobantes-electronicos-ws/AutorizacionComprobantesOffline?wsdl';
  defURL  = 'https://cel.sri.gob.ec/comprobantes-electronicos-ws/AutorizacionComprobantesOffline';
  defSvc  = 'AutorizacionComprobantesOfflineService';
  defPrt  = 'AutorizacionComprobantesOfflinePort';
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 AutorizacionComprobantesOffline);
    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;


destructor respuestaComprobante.Destroy;
var
  I: Integer;
begin
  for I := 0 to System.Length(Fautorizaciones)-1 do
    SysUtils.FreeAndNil(Fautorizaciones[i]);
  System.SetLength(Fautorizaciones, 0);
  inherited Destroy;
end;

procedure respuestaComprobante.SetclaveAccesoConsultada(Index: Integer; const Astring: string);
begin
  FclaveAccesoConsultada := Astring;
  FclaveAccesoConsultada_Specified := True;
end;

function respuestaComprobante.claveAccesoConsultada_Specified(Index: Integer): boolean;
begin
  Result := FclaveAccesoConsultada_Specified;
end;

procedure respuestaComprobante.SetnumeroComprobantes(Index: Integer; const Astring: string);
begin
  FnumeroComprobantes := Astring;
  FnumeroComprobantes_Specified := True;
end;

function respuestaComprobante.numeroComprobantes_Specified(Index: Integer): boolean;
begin
  Result := FnumeroComprobantes_Specified;
end;

procedure respuestaComprobante.Setautorizaciones(Index: Integer; const Aautorizaciones: autorizaciones);
begin
  Fautorizaciones := Aautorizaciones;
  Fautorizaciones_Specified := True;
end;

function respuestaComprobante.autorizaciones_Specified(Index: Integer): boolean;
begin
  Result := Fautorizaciones_Specified;
end;

destructor autorizacion.Destroy;
var
  I: Integer;
begin
  for I := 0 to System.Length(Fmensajes)-1 do
    SysUtils.FreeAndNil(Fmensajes[i]);
  System.SetLength(Fmensajes, 0);
  SysUtils.FreeAndNil(FfechaAutorizacion);
  inherited Destroy;
end;

procedure autorizacion.Setestado(Index: Integer; const Astring: string);
begin
  Festado := Astring;
  Festado_Specified := True;
end;

function autorizacion.estado_Specified(Index: Integer): boolean;
begin
  Result := Festado_Specified;
end;

procedure autorizacion.SetnumeroAutorizacion(Index: Integer; const Astring: string);
begin
  FnumeroAutorizacion := Astring;
  FnumeroAutorizacion_Specified := True;
end;

function autorizacion.numeroAutorizacion_Specified(Index: Integer): boolean;
begin
  Result := FnumeroAutorizacion_Specified;
end;

procedure autorizacion.SetfechaAutorizacion(Index: Integer; const ATXSDateTime: TXSDateTime);
begin
  FfechaAutorizacion := ATXSDateTime;
  FfechaAutorizacion_Specified := True;
end;

function autorizacion.fechaAutorizacion_Specified(Index: Integer): boolean;
begin
  Result := FfechaAutorizacion_Specified;
end;

procedure autorizacion.Setambiente(Index: Integer; const Astring: string);
begin
  Fambiente := Astring;
  Fambiente_Specified := True;
end;

function autorizacion.ambiente_Specified(Index: Integer): boolean;
begin
  Result := Fambiente_Specified;
end;

procedure autorizacion.Setcomprobante(Index: Integer; const Astring: string);
begin
  Fcomprobante := Astring;
  Fcomprobante_Specified := True;
end;

function autorizacion.comprobante_Specified(Index: Integer): boolean;
begin
  Result := Fcomprobante_Specified;
end;

procedure autorizacion.Setmensajes(Index: Integer; const Amensajes: mensajes);
begin
  Fmensajes := Amensajes;
  Fmensajes_Specified := True;
end;

function autorizacion.mensajes_Specified(Index: Integer): boolean;
begin
  Result := Fmensajes_Specified;
end;

procedure mensaje.Setidentificador(Index: Integer; const Astring: string);
begin
  Fidentificador := Astring;
  Fidentificador_Specified := True;
end;

function mensaje.identificador_Specified(Index: Integer): boolean;
begin
  Result := Fidentificador_Specified;
end;

procedure mensaje.Setmensaje(Index: Integer; const Astring: string);
begin
  Fmensaje := Astring;
  Fmensaje_Specified := True;
end;

function mensaje.mensaje_Specified(Index: Integer): boolean;
begin
  Result := Fmensaje_Specified;
end;

procedure mensaje.SetinformacionAdicional(Index: Integer; const Astring: string);
begin
  FinformacionAdicional := Astring;
  FinformacionAdicional_Specified := True;
end;

function mensaje.informacionAdicional_Specified(Index: Integer): boolean;
begin
  Result := FinformacionAdicional_Specified;
end;

procedure mensaje.Settipo(Index: Integer; const Astring: string);
begin
  Ftipo := Astring;
  Ftipo_Specified := True;
end;

function mensaje.tipo_Specified(Index: Integer): boolean;
begin
  Result := Ftipo_Specified;
end;

destructor respuestaLote.Destroy;
var
  I: Integer;
begin
  for I := 0 to System.Length(Fautorizaciones)-1 do
    SysUtils.FreeAndNil(Fautorizaciones[i]);
  System.SetLength(Fautorizaciones, 0);
  inherited Destroy;
end;

procedure respuestaLote.SetclaveAccesoLoteConsultada(Index: Integer; const Astring: string);
begin
  FclaveAccesoLoteConsultada := Astring;
  FclaveAccesoLoteConsultada_Specified := True;
end;

function respuestaLote.claveAccesoLoteConsultada_Specified(Index: Integer): boolean;
begin
  Result := FclaveAccesoLoteConsultada_Specified;
end;

procedure respuestaLote.SetnumeroComprobantesLote(Index: Integer; const Astring: string);
begin
  FnumeroComprobantesLote := Astring;
  FnumeroComprobantesLote_Specified := True;
end;

function respuestaLote.numeroComprobantesLote_Specified(Index: Integer): boolean;
begin
  Result := FnumeroComprobantesLote_Specified;
end;

procedure respuestaLote.Setautorizaciones(Index: Integer; const Aautorizaciones2: autorizaciones2);
begin
  Fautorizaciones := Aautorizaciones2;
  Fautorizaciones_Specified := True;
end;

function respuestaLote.autorizaciones_Specified(Index: Integer): boolean;
begin
  Result := Fautorizaciones_Specified;
end;

initialization
  InvRegistry.RegisterInterface(TypeInfo(AutorizacionComprobantesOffline), 'http://ec.gob.sri.ws.autorizacion', 'UTF-8');
  InvRegistry.RegisterDefaultSOAPAction(TypeInfo(AutorizacionComprobantesOffline), '');
  InvRegistry.RegisterInvokeOptions(TypeInfo(AutorizacionComprobantesOffline), ioDocument);
  RemClassRegistry.RegisterXSInfo(TypeInfo(autorizaciones), 'http://ec.gob.sri.ws.autorizacion', 'autorizaciones');
  RemClassRegistry.RegisterXSClass(respuestaComprobante, 'http://ec.gob.sri.ws.autorizacion', 'respuestaComprobante');
  RemClassRegistry.RegisterXSInfo(TypeInfo(mensajes), 'http://ec.gob.sri.ws.autorizacion', 'mensajes');
  RemClassRegistry.RegisterXSClass(autorizacion, 'http://ec.gob.sri.ws.autorizacion', 'autorizacion');
  RemClassRegistry.RegisterXSClass(autorizacion2, 'http://ec.gob.sri.ws.autorizacion', 'autorizacion2', 'autorizacion');
  RemClassRegistry.RegisterXSClass(mensaje, 'http://ec.gob.sri.ws.autorizacion', 'mensaje');
  RemClassRegistry.RegisterXSClass(mensaje2, 'http://ec.gob.sri.ws.autorizacion', 'mensaje2', 'mensaje');
  RemClassRegistry.RegisterXSInfo(TypeInfo(autorizaciones2), 'http://ec.gob.sri.ws.autorizacion', 'autorizaciones2', 'autorizaciones');
  RemClassRegistry.RegisterXSClass(respuestaLote, 'http://ec.gob.sri.ws.autorizacion', 'respuestaLote');

end.
__________________
IVAND
Responder Con Cita