cara, show de bola....consegui 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 > "78000000" 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. <http://www.byjg.com.br> com.br <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 > <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 > <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; 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: Boolean; Addr: string; HTTPRIO: > THTTPRIO): CEPServicePort; > const > defWSDL = > '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>'; > defURL = 'http://www.byjg. <http://www.byjg.com.br/xmlnuke-php/webservice.php/ws/cep> com.br/xmlnuke-php/webservice.php/ws/cep > <http://www.byjg. <http://www.byjg.com.br/xmlnuke-php/webservice.php/ws/cep> com.br/xmlnuke-php/webservice.php/ws/cep>'; > defSvc = 'CEPService'; > defPrt = 'CEPServicePort'; > 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 CEPServicePort); > 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(CEPServicePort), > 'urn:http://www.byjg. <http://www.byjg.com.br> com.br <http://www.byjg. <http://www.byjg.com.br> com.br>', 'utf-8'); > InvRegistry.RegisterDefaultSOAPAction(TypeInfo(CEPServicePort), > 'urn:CEPServiceAction'); > RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfstring), > 'urn:CEPService', 'ArrayOfstring'); > > end. > ============================ > > Emerson Cassio > > ----- Original Message ----- > From: Valfrid-Ly Silva Couto > To: [EMAIL PROTECTED] <mailto:delphi-br%40yahoogrupos.com.br> os.com.br <mailto:delphi-br%40yahoogrupos.com.br> > Sent: Thursday, January 04, 2007 5:42 PM > Subject: Re: [delphi-br] Usar serviço do correio para conseguir CEP > através da aplicação > > A lista não aceita anexos! > > Marcio Cruz <marcio.cruuz@ <mailto:marcio.cruuz%40itelefonica.com.br> itelefonica.com.br > <mailto:marcio.cruuz%40itelefonica.com.br>> escreveu: Olá amigos, > > este arquivo em anexo eu consegui no site do correios... Agora, como > será que faríamos uma aplicação que, ao clicarmos em "buscar", ele > traria as informações de endereço referente ao CEP? > > Obrigado > > [As partes desta mensagem que não continham texto foram removidas] > > -- > <<<<< FAVOR REMOVER ESTA PARTE AO RESPONDER ESTA MENSAGEM >>>>> > > Links do Yahoo! Grupos > > Valfrid-Ly Silva Couto > [EMAIL PROTECTED] <mailto:valfrid%40uol.com.br> com.br <mailto:valfrid%40uol.com.br> > [EMAIL PROTECTED] <mailto:valfrid%40intermega.com.br> com.br <mailto:valfrid%40intermega.com.br> > [EMAIL PROTECTED] <mailto:valfrid_ly%40hotmail.com> com <mailto:valfrid_ly%40hotmail.com> > ICQ 15114646 > __________________________________________________ > Fale com seus amigos de graça com o novo Yahoo! Messenger > http://br.messenger <http://br.messenger.yahoo.com/> .yahoo.com/ <http://br.messenger <http://br.messenger.yahoo.com/> .yahoo.com/> > > [As partes desta mensagem que não continham texto foram removidas] > > __________ Informação do NOD32 IMON 1957 (20070104) __________ > > Esta mensagem foi verificada pelo NOD32 sistema antivírus > http://www.eset. <http://www.eset.com.br> com.br <http://www.eset. <http://www.eset.com.br> com.br> > > [As partes desta mensagem que não continham texto foram removidas] > > _______________________________________________________ Yahoo! Mail - Sempre a melhor opção para você! Experimente já e veja as novidades. http://br.yahoo. <http://br.yahoo.com/mailbeta/tudonovo/> com/mailbeta/tudonovo/ __________ Informação do NOD32 IMON 1969 (20070110) __________ Esta mensagem foi verificada pelo NOD32 sistema antivírus http://www.eset. <http://www.eset.com.br> com.br [As partes desta mensagem que não continham texto foram removidas] [As partes desta mensagem que não continham texto foram removidas]