RES: [delphi-br] Usar serviço do correio para conseg uir CEP através da aplicação
Boa tarde amigos !!! Criei a pequena aplicação aqui e funcionou corretamente, porém estou com algumas dúvidas. Como um amigo da lista até mencionou tem determinados CEPs que não encontramos, ou seja, não estão na base. Então, que base é essa ? É a do correios ? É a mais recente ? E se não for a do correios, alguém aqui já teve experiência em licenciar a base do correios ? Atenciosamente, Jader Ricardo _ De: delphi-br@yahoogrupos.com.br [mailto:[EMAIL PROTECTED] Em nome de Emerson Cassio Enviada em: sábado, 6 de janeiro de 2007 01:17 Para: delphi-br@yahoogrupos.com.br Assunto: Re: [delphi-br] Usar serviço do correio para conseguir CEP através da aplicação Crie um novo Projeto (Delphi 7 em diante) Salve o projeto e a unit. Clique File..New...Other Selecione a Aba WebServices WSDL Importer...Ok em Location of WSDLFileor URL digite: http://www.byjg. http://www.byjg.com.br/xmlnuke-php/webservice.php/ws/cep?wsdl com.br/xmlnuke-php/webservice.php/ws/cep?wsdl Clique Next...Finish Salve a unit criada com o nome CEP Selecione o Form Principal do Projeto Clique File...Use Unit...Selecione CEP e clique OK. Adicione no Form o componente HTTPRIO da aba WebServices Propriedade WSDLLocation coloque http://www.byjg. http://www.byjg.com.br/xmlnuke-php/webservice.php/ws/cep?wsdl com.br/xmlnuke-php/webservice.php/ws/cep?wsdl Propriedade Service coloque CEPService Propriedade Port coloque CEPServicePort Adicione no Form um Componente Edit e um Botão De dois Clique no Botão e adicione o seguinte código: procedure TForm1.Button1Click(Sender: TObject); var ObjSoap : CEPServicePort; Num : string; begin ObjSoap:=HTTPRIO1 as CEPServicePort; Num:=Edit1.text; memo1.Lines.Add(ObjSoap.obterLogradouro(Num)); end; Pronto rode o projeto, digite o cep no Edit tanto faz o formato 7800 ou 78000-000 clique o botão e no memo aparecerá o respectivo endereço, bastando usar a criatividade para usar da forma que melhor convir. Codigo completo da Unit Principal unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, InvokeRegistry, StdCtrls, Rio, SOAPHTTPClient; type TForm1 = class(TForm) HTTPRIO1: THTTPRIO; Button1: TButton; Edit1: TEdit; Memo1: TMemo; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation uses cep; {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var ObjSoap : CEPServicePort; Num : string; begin ObjSoap:=HTTPRIO1 as CEPServicePort; Num:=Edit1.text; memo1.Lines.Add(ObjSoap.obterLogradouro(Num)); end; end. Codigo Completo da Unit CEP // // // The types declared in this file were generated from data read from the // WSDL File described below: // WSDL : http://www.byjg. http://www.byjg.com.br/xmlnuke-php/webservice.php/ws/cep?wsdl com.br/xmlnuke-php/webservice.php/ws/cep?wsdl // Encoding : utf-8 // Version : 1.0 // (06-01-07 00:54:32 - 1.33.2.5) // // unit cep; 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 [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. http://www.w3.org/2001/XMLSchema org/2001/XMLSchema ArrayOfstring = array of WideString; { urn:CEPService } // // // Namespace : urn:http://www.byjg. http://www.byjg.com.br com.br // soapAction: urn:CEPServiceAction // transport : http://schemas. http://schemas.xmlsoap.org/soap/http xmlsoap.org/soap/http // style : rpc // binding : CEPServiceBinding // service : CEPService // port : CEPServicePort // URL : http://www.byjg. http://www.byjg.com.br/xmlnuke-php/webservice.php/ws/cep com.br/xmlnuke-php/webservice.php/ws/cep // // CEPServicePort = interface(IInvokable) ['{EC28595B-95D2-DE51-E5B1-57B81D4826D3}'] function obterVersao: WideString; stdcall; function obterLogradouro(const cep: WideString): WideString; stdcall; function obterCEP(const logradouro: WideString; const localidade: WideString; const UF: WideString): ArrayOfstring; stdcall; function obterCEPAuth(const logradouro: WideString; const localidade: WideString;
RES: [delphi-br] Usar serviço do correio para conseg uir CEP através da aplicação
cara, show de bolaconsegui e realmente , com resultados fantasticos...agora vou tentar implementar digitando o endereco..vamos ver no que dá -Mensagem original- De: delphi-br@yahoogrupos.com.br [mailto:[EMAIL PROTECTED] Em nome de Emerson Cassio Enviada em: quarta-feira, 10 de janeiro de 2007 15:52 Para: delphi-br@yahoogrupos.com.br Assunto: Re: [delphi-br] Usar serviço do correio para conseguir CEP através da aplicação Essa mensagem retorna qdo não encontra o cep na base de dados, já tentou outro cep? - Original Message - From: galvao_em To: [EMAIL PROTECTED] mailto:delphi-br%40yahoogrupos.com.br os.com.br Sent: Wednesday, January 10, 2007 1:07 PM Subject: Re: [delphi-br] Usar serviço do correio para conseguir CEP através da aplicação Olá, fiz como está descrito no passo a passo abaixo, mas na hora de pesquisar ele me retorna que o cep não foi encontrado. que devo fazer? Att. Rodrigo Emerson Cassio escreveu: Crie um novo Projeto (Delphi 7 em diante) Salve o projeto e a unit. Clique File..New...Other Selecione a Aba WebServices WSDL Importer...Ok em Location of WSDLFileor URL digite: http://www.byjg. http://www.byjg.com.br/xmlnuke-php/webservice.php/ws/cep?wsdl com.br/xmlnuke-php/webservice.php/ws/cep?wsdl http://www.byjg. http://www.byjg.com.br/xmlnuke-php/webservice.php/ws/cep?wsdl com.br/xmlnuke-php/webservice.php/ws/cep?wsdl Clique Next...Finish Salve a unit criada com o nome CEP Selecione o Form Principal do Projeto Clique File...Use Unit...Selecione CEP e clique OK. Adicione no Form o componente HTTPRIO da aba WebServices Propriedade WSDLLocation coloque http://www.byjg. http://www.byjg.com.br/xmlnuke-php/webservice.php/ws/cep?wsdl com.br/xmlnuke-php/webservice.php/ws/cep?wsdl http://www.byjg. http://www.byjg.com.br/xmlnuke-php/webservice.php/ws/cep?wsdl com.br/xmlnuke-php/webservice.php/ws/cep?wsdl Propriedade Service coloque CEPService Propriedade Port coloque CEPServicePort Adicione no Form um Componente Edit e um Botão De dois Clique no Botão e adicione o seguinte código: procedure TForm1.Button1Click(Sender: TObject); var ObjSoap : CEPServicePort; Num : string; begin ObjSoap:=HTTPRIO1 as CEPServicePort; Num:=Edit1.text; memo1.Lines.Add(ObjSoap.obterLogradouro(Num)); end; Pronto rode o projeto, digite o cep no Edit tanto faz o formato 7800 ou 78000-000 clique o botão e no memo aparecerá o respectivo endereço, bastando usar a criatividade para usar da forma que melhor convir. Codigo completo da Unit Principal unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, InvokeRegistry, StdCtrls, Rio, SOAPHTTPClient; type TForm1 = class(TForm) HTTPRIO1: THTTPRIO; Button1: TButton; Edit1: TEdit; Memo1: TMemo; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation uses cep; {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var ObjSoap : CEPServicePort; Num : string; begin ObjSoap:=HTTPRIO1 as CEPServicePort; Num:=Edit1.text; memo1.Lines.Add(ObjSoap.obterLogradouro(Num)); end; end. Codigo Completo da Unit CEP // // // The types declared in this file were generated from data read from the // WSDL File described below: // WSDL : http://www.byjg. http://www.byjg.com.br/xmlnuke-php/webservice.php/ws/cep?wsdl com.br/xmlnuke-php/webservice.php/ws/cep?wsdl http://www.byjg. http://www.byjg.com.br/xmlnuke-php/webservice.php/ws/cep?wsdl com.br/xmlnuke-php/webservice.php/ws/cep?wsdl // Encoding : utf-8 // Version : 1.0 // (06-01-07 00:54:32 - 1.33.2.5) // // unit cep; 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 [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. http://www.w3.org/2001/XMLSchema org/2001/XMLSchema http://www.w3. http://www.w3.org/2001/XMLSchema org/2001/XMLSchema ArrayOfstring = array of WideString; { urn:CEPService } // // // Namespace : urn:http://www.byjg.
RES: [delphi-br] Usar serviço do correio para conseg uir CEP através da aplicação
Emerson, Show de bola companheiro. É isso aí. Saudações. --- []s Alexandre Frase da semana: Apenas uma guerra é permitida à espécie humana: a guerra contra a extinção (Isaac Asimov) Frase de la semana: Solo una guerra se permite al hombre: la guerra contra el desaparición (Isaac Asimov) -Mensagem original- De: delphi-br@yahoogrupos.com.br [mailto:[EMAIL PROTECTED] Em nome de Emerson Cassio Enviada em: sábado, 6 de janeiro de 2007 01:17 Para: delphi-br@yahoogrupos.com.br Assunto: Re: [delphi-br] Usar serviço do correio para conseguir CEP através da aplicação Crie um novo Projeto (Delphi 7 em diante) Salve o projeto e a unit. Clique File..New...Other Selecione a Aba WebServices WSDL Importer...Ok em Location of WSDLFileor URL digite: http://www.byjg.com.br/xmlnuke-php/webservice.php/ws/cep?wsdl Clique Next...Finish Salve a unit criada com o nome CEP Selecione o Form Principal do Projeto Clique File...Use Unit...Selecione CEP e clique OK. Adicione no Form o componente HTTPRIO da aba WebServices Propriedade WSDLLocation coloque http://www.byjg.com.br/xmlnuke-php/webservice.php/ws/cep?wsdl Propriedade Service coloque CEPService Propriedade Port coloque CEPServicePort Adicione no Form um Componente Edit e um Botão De dois Clique no Botão e adicione o seguinte código: procedure TForm1.Button1Click(Sender: TObject); var ObjSoap : CEPServicePort; Num : string; begin ObjSoap:=HTTPRIO1 as CEPServicePort; Num:=Edit1.text; memo1.Lines.Add(ObjSoap.obterLogradouro(Num)); end; Pronto rode o projeto, digite o cep no Edit tanto faz o formato 7800 ou 78000-000 clique o botão e no memo aparecerá o respectivo endereço, bastando usar a criatividade para usar da forma que melhor convir. Codigo completo da Unit Principal unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, InvokeRegistry, StdCtrls, Rio, SOAPHTTPClient; type TForm1 = class(TForm) HTTPRIO1: THTTPRIO; Button1: TButton; Edit1: TEdit; Memo1: TMemo; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation uses cep; {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var ObjSoap : CEPServicePort; Num : string; begin ObjSoap:=HTTPRIO1 as CEPServicePort; Num:=Edit1.text; memo1.Lines.Add(ObjSoap.obterLogradouro(Num)); end; end. Codigo Completo da Unit CEP // // // The types declared in this file were generated from data read from the // WSDL File described below: // WSDL : http://www.byjg.com.br/xmlnuke-php/webservice.php/ws/cep?wsdl // Encoding : utf-8 // Version : 1.0 // (06-01-07 00:54:32 - 1.33.2.5) // // unit cep; 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 [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; ArrayOfstring = array of WideString; { urn:CEPService } // // // Namespace : urn:http://www.byjg.com.br // soapAction: urn:CEPServiceAction // transport : http://schemas.xmlsoap.org/soap/http // style : rpc // binding : CEPServiceBinding // service : CEPService // port : CEPServicePort // URL : http://www.byjg.com.br/xmlnuke-php/webservice.php/ws/cep // // CEPServicePort = interface(IInvokable) ['{EC28595B-95D2-DE51-E5B1-57B81D4826D3}'] function obterVersao: WideString; stdcall; function obterLogradouro(const cep: WideString): WideString; stdcall; function obterCEP(const logradouro: WideString; const localidade: WideString; const UF: WideString): ArrayOfstring; stdcall; function obterCEPAuth(const logradouro: WideString; const localidade: WideString; const UF: WideString; const usuario: WideString; const senha: WideString): ArrayOfstring; stdcall; end; function GetCEPServicePort(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): CEPServicePort; implementation function GetCEPServicePort(UseWSDL: