Senhores, alguém da lista já conseguiu desenvolver em Delphi7 a rotina para consumir o WebService da Sefaz/SP para autenticação do uisuario e envio dos arquivos para validação e posterior envio normal de produção?
Usei o assistente do wsdl importer informo a url da sefaz/sp carrega monta a unit arquivocf.pas tem o método de enviar e consultar mas não importa nada referente a autenticação do usiário (soap12: header), não estou conseguindo encontrar material para autenticação. Desde já agradeço qualquer ajuda. O que consegui segue abaixo. o arquivocf.pas com as minhas alterações sem sucesso. // ************************************************************************ // // The types declared in this file were generated from data read from the // WSDL File described below: // WSDL : https://www.nfp.fazenda.sp.gov.br/ws/arquivocf.asmx?WSDL // Encoding : utf-8 // Codegen : [wfDebug,wfServer,wfAmbiguousComplexTypesAsArray,wfOutputLiteralTypes,wfIgnoreSchemaErrors,wfUseSerializerClassForAttrs,wfGenTrueGUIDs] // Version : 1.0 // (3/4/2008 21:12:26 - 1.33.2.5) // ************************************************************************ // unit arquivocf; interface uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns, rio; type // ************************************************************************ // // The following types, referred to in the WSDL document are not being represented // in this file. They are either [EMAIL PROTECTED] 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" // !:boolean - "http://www.w3.org/2001/XMLSchema" // !:Byte - "http://www.w3.org/2001/XMLSchema" ConsultarResponse = class; { "https://www.nfp.sp.gov.br/ws" } Consultar = class; { "https://www.nfp.sp.gov.br/ws" } EnviarResponse = class; { "https://www.nfp.sp.gov.br/ws" } Enviar = class; { "https://www.nfp.sp.gov.br/ws" } {criado por mim} TAutenticacao = class; { "https://www.nfp.sp.gov.br/ws" } {criado por mim} TAutenticacao = class(TSOAPHeader) private FUsuario: WideString; FSenha: WideString; FCNPJ: WideString; FCategoriaUsuario: Byte; published property Usuario: WideString read FUsuario write FUsuario; property Senha: WideString read FSenha write FSenha; property CNPJ: WideString read FCNPJ write FCNPJ; property CategoriaUsuario: Byte read FCategoriaUsuario write FCategoriaUsuario; end; // ************************************************************************ // // Namespace : https://www.nfp.sp.gov.br/ws // ************************************************************************ // ConsultarResponse = class(TRemotable) private FConsultarResult: WideString; published property ConsultarResult: WideString read FConsultarResult write FConsultarResult; end; // ************************************************************************ // // Namespace : https://www.nfp.sp.gov.br/ws // ************************************************************************ // Consultar = class(TRemotable) private FProtocolo: WideString; published property Protocolo: WideString read FProtocolo write FProtocolo; end; // ************************************************************************ // // Namespace : https://www.nfp.sp.gov.br/ws // ************************************************************************ // EnviarResponse = class(TRemotable) private FEnviarResult: WideString; published property EnviarResult: WideString read FEnviarResult write FEnviarResult; end; // ************************************************************************ // // Namespace : https://www.nfp.sp.gov.br/ws // ************************************************************************ // Enviar = class(TRemotable) private FNomeArquivo: WideString; FConteudoArquivo: WideString; FEnvioNormal: Boolean; FObservacoes: WideString; published property NomeArquivo: WideString read FNomeArquivo write FNomeArquivo; property ConteudoArquivo: WideString read FConteudoArquivo write FConteudoArquivo; property EnvioNormal: Boolean read FEnvioNormal write FEnvioNormal; property Observacoes: WideString read FObservacoes write FObservacoes; end; // ************************************************************************ // // Namespace : https://www.nfp.sp.gov.br/ws // binding : ArquivoCFSoap12 // service : ArquivoCF // port : ArquivoCFSoap12 // ************************************************************************ // ArquivoCFSoap12 = interface(IInvokable) ['{2DCA6819-B5C9-4D72-A9CE-A7D4765ED3E5}'] function Enviar(const parameters: Enviar): EnviarResponse; stdcall; function Consultar(const parameters: Consultar): ConsultarResponse; stdcall; end; function GetArquivoCFSoap12(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): ArquivoCFSoap12; implementation function GetArquivoCFSoap12(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): ArquivoCFSoap12; const defWSDL = 'https://www.nfp.fazenda.sp.gov.br/ws/arquivocf.asmx?WSDL'; defURL = ''; defSvc = 'ArquivoCF'; defPrt = 'ArquivoCFSoap12'; 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 ArquivoCFSoap12); 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(ArquivoCFSoap12), 'https://www.nfp.sp.gov.br/ws', 'utf-8'); InvRegistry.RegisterDefaultSOAPAction(TypeInfo(ArquivoCFSoap12), ''); RemClassRegistry.RegisterXSClass(ConsultarResponse, 'https://www.nfp.sp.gov.br/ws', 'ConsultarResponse'); RemClassRegistry.RegisterXSClass(Consultar, 'https://www.nfp.sp.gov.br/ws', 'Consultar'); RemClassRegistry.RegisterXSClass(EnviarResponse, 'https://www.nfp.sp.gov.br/ws', 'EnviarResponse'); RemClassRegistry.RegisterXSClass(Enviar, 'https://www.nfp.sp.gov.br/ws', 'Enviar'); {criado por mim} InvRegistry.RegisterHeaderClass(TypeInfo(ArquivoCFSoap12), TAutenticacao); RemClassRegistry.RegisterXSClass(TAutenticacao); end. a minha unit cliente para consumo do serviço também sem sucesso unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, arquivocf, InvokeRegistry, StdCtrls, Rio, SOAPHTTPClient, ExtCtrls; type TForm1 = class(TForm) HTTPRIO1: THTTPRIO; Button1: TButton; OD: TOpenDialog; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var x: ArquivoCFSoap12; y: enviar; a: TAutenticacao; Headers: ISOAPHeaders; sl: TStringList; begin try x := GetArquivoCFSoap12(true, '', nil); if od.Execute then begin sl := TStringList.Create; sl.LoadFromFile(od.FileName); x := (httprio1 as ArquivoCFSoap12); a := TAutenticacao.Create; a.Usuario := 'usuario'; a.Senha := 'senha'; a.CNPJ := '00000000000000'; a.CategoriaUsuario := 2; Headers := x as ISoapHeaders; Headers.Get(TAutenticacao, TSoapHeader(a)); (x as ISOAPHeaders).send(a); y := enviar.Create; y.NomeArquivo := od.FileName; y.ConteudoArquivo := sl.GetText; y.EnvioNormal := False; y.Observacoes := 'teste de web service'; (x as ArquivoCFSoap12).Enviar(y); end; finally y.Free; a.Free; end; end; end.