Ver um Único Post

 
  #3 (permalink)  
Antigo 20/10/2010
Avatar de LuizVaz
LuizVaz LuizVaz está offline
Administrator
Super Admin
Points: 10,505, Level: 68 Points: 10,505, Level: 68 Points: 10,505, Level: 68
Activity: 0% Activity: 0% Activity: 0%
Last Achievements
 
Registrado em: Oct 2009
Localização: Belo Horizonte
Posts: 86
Thanks: 2
Thanked 6 Times in 6 Posts
Activity Longevity
0/20 20/20
Today Posts
sssssss86
Enviar mensagem via Windows Live Messenger para LuizVaz Enviar mensagem via Yahoo para LuizVaz
Padrão

O Problema é a implementação da UNIT.

Use o seguinte:

Código:
// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL     : wsGINFES.xml
// (26/08/2010 23:13:40 - - $Rev: 16699 $)
// ************************************************************************ //

unit wsGINFES;

interface

uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;

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"[]


  // ************************************************************************ //
  // Namespace : http://homologacao.ginfes.com.br
  // transport : http://schemas.xmlsoap.org/soap/http
  // style     : rpc
  // binding   : ServiceGinfesImplBinding
  // service   : ServiceGinfesImplService
  // port      : ServiceGinfesImplPort
  // URL       : https://homologacao.ginfes.com.br//ServiceGinfesImpl
  // ************************************************************************ //
  ServiceGinfesImpl = interface(IInvokable)
  ['{F14196C8-E410-BEBA-7FAC-0B55E7C1FD05}']
    function  CancelarNfse(const arg0: string): string; stdcall;
    function  CancelarNfseV3(const arg0: string; const arg1: string): string; stdcall;
    function  ConsultarLoteRps(const arg0: string): string; stdcall;
    function  ConsultarLoteRpsV3(const arg0: string; const arg1: string): string; stdcall;
    function  ConsultarNfse(const arg0: string): string; stdcall;
    function  ConsultarNfsePorRps(const arg0: string): string; stdcall;
    function  ConsultarNfsePorRpsV3(const arg0: string; const arg1: string): string; stdcall;
    function  ConsultarNfseV3(const arg0: string; const arg1: string): string; stdcall;
    function  ConsultarSituacaoLoteRps(const arg0: string): string; stdcall;
    function  ConsultarSituacaoLoteRpsV3(const arg0: string; const arg1: string): string; stdcall;
    function  RecepcionarLoteRps(const arg0: string): string; stdcall;
    function  RecepcionarLoteRpsV3(const arg0: string; const arg1: string): string; stdcall;
  end;
  GINFES = ServiceGinfesImpl;

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


implementation
  uses SysUtils;

function GetGINFES(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): GINFES;
const
  defWSDL = 'wsGINFES.xml';
  defURL  = 'https://homologacao.ginfes.com.br//ServiceGinfesImpl';
  defSvc  = 'ServiceGinfesImplService';
  defPrt  = 'ServiceGinfesImplPort';
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 ServiceGinfesImpl);
    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;


initialization
  InvRegistry.RegisterInterface(TypeInfo(ServiceGinfesImpl), 'http://homologacao.ginfes.com.br', '');
  InvRegistry.RegisterDefaultSOAPAction(TypeInfo(ServiceGinfesImpl), '');

end.
Para utilizar, crie um RIO assim:

Código:
var
  wsGINFES: GINFES;
  FHTTPRIO: THTTPRIO;

  //HTTPRIO
  FHTTPRIO := THTTPRIO.Create(Self);
  FHTTPRIO.HTTPWebNode.UseUTF8InHeader := True;
  FHTTPRIO.HTTPWebNode.InvokeOptions := [soIgnoreInvalidCerts, soAutoCheckAccessPointViaUDDI];
  FHTTPRIO.HTTPWebNode.OnBeforePost := DoBeforePost;
  FHTTPRIO.OnBeforeExecute := DoBeforeExecute;
  FHTTPRIO.Converter.Options := [soSendMultiRefObj, soTryAllSchema,
                                 soRootRefNodesToBody, soCacheMimeResponse];


  If (wsGINFES = nil) Then
    wsGINFES := GetGINFES(FALSE, URLWebServices, FHTTPRio);
Onde URLWebServices pode ser:
'https:\\producao.ginfes.com.br\\ServiceGinfesImpl '
'https:\\homologacao.ginfes.com.br\\ServiceGinfesI mpl'


Atenciosamente,
Luiz Vaz
Responder com Citação
The Following User Says Thank You to LuizVaz For This Useful Post:
 

Content Relevant URLs by vBSEO 3.3.0