Pessoal,
estou tenato usar o webservice apontado pelo link:
http://www.byjg.com.br/xmlnuke/xmlnuke.aspx?xml=onlinecep&site=byjg&xsl=page&lang=pt-br#H3

Consegue a unit abaixo gerada pelo Delphi7:

      Código: 


      // 
************************************************************************ // 
      // The types declared in this file were generated from data read from the 
      // WSDL File described below: 
      // WSDL     : 
http://www.byjg.com.br/xmlnuke/webservice/cepservice.asmx?WSDL 
      // Encoding : utf-8 
      // Version  : 1.0 
      // (17/5/2005 10:16:01 - 1.33.2.5) 
      // 
************************************************************************ // 

      unit cepservice; 

      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"; 
        // !:                - "http://www.byjg.com.br"; 

        ArrayOfAnyType       = class;                 { 
"http://www.byjg.com.br"[A] } 

        anyType    = array of Variant;                { 
"http://www.byjg.com.br"; } 


        // 
************************************************************************ // 
        // Namespace : http://www.byjg.com.br 
        // Serializtn: [xoInlineArrays] 
        // 
************************************************************************ // 
        ArrayOfAnyType = class(TRemotable) 
        private 
          FanyType: anyType; 
        public 
          constructor Create; override; 
          function   GetVariantArray(Index: Integer): Variant; 
          function   GetVariantArrayLength: Integer; 
          property   VariantArray[Index: Integer]: Variant read 
GetVariantArray; default; 
          property   Len: Integer read GetVariantArrayLength; 
        published 
          property anyType: anyType read FanyType write FanyType; 
        end; 


        // 
************************************************************************ // 
        // Namespace : http://www.byjg.com.br 
        // soapAction: http://www.byjg.com.br/%operationName% 
        // transport : http://schemas.xmlsoap.org/soap/http 
        // style     : document 
        // binding   : ConsultaCEPSoap 
        // service   : ConsultaCEP 
        // port      : ConsultaCEPSoap 
        // URL       : 
http://www.byjg.com.br/xmlnuke/webservice/cepservice.asmx 
        // 
************************************************************************ // 
        ConsultaCEPSoap = interface(IInvokable) 
        ['{27F8F6FA-71AC-B27A-F216-9F887FD4E868}'] 
          function  obterLogradouro(const Cep: WideString): WideString; 
stdcall; 
          function  obterCEP(const Logradouro: WideString; const Localidade: 
WideString; const UF: WideString): ArrayOfAnyType; stdcall; 
          function  obterVersao: WideString; stdcall; 
        end; 

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


      implementation 

      function GetConsultaCEPSoap(UseWSDL: Boolean; Addr: string; HTTPRIO: 
THTTPRIO): ConsultaCEPSoap; 
      const 
        defWSDL = 
'http://www.byjg.com.br/xmlnuke/webservice/cepservice.asmx?WSDL'; 
        defURL  = 'http://www.byjg.com.br/xmlnuke/webservice/cepservice.asmx'; 
        defSvc  = 'ConsultaCEP'; 
        defPrt  = 'ConsultaCEPSoap'; 
      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 ConsultaCEPSoap); 
          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; 


      constructor ArrayOfAnyType.Create; 
      begin 
        inherited Create; 
        FSerializationOptions := [xoInlineArrays]; 
      end; 

      function ArrayOfAnyType.GetVariantArray(Index: Integer): Variant; 
      begin 
        Result := FanyType[Index]; 
      end; 

      function ArrayOfAnyType.GetVariantArrayLength: Integer; 
      begin 
        if Assigned(FanyType) then 
          Result := Length(FanyType) 
        else 
        Result := 0; 
      end; 

      initialization 
        InvRegistry.RegisterInterface(TypeInfo(ConsultaCEPSoap), 
'http://www.byjg.com.br', 'utf-8'); 
        InvRegistry.RegisterDefaultSOAPAction(TypeInfo(ConsultaCEPSoap), 
'http://www.byjg.com.br/%operationName%'); 
        InvRegistry.RegisterInvokeOptions(TypeInfo(ConsultaCEPSoap), 
ioDocument); 
        RemClassRegistry.RegisterXSInfo(TypeInfo(anyType), 
'http://www.byjg.com.br', 'anyType'); 
        RemClassRegistry.RegisterXSClass(ArrayOfAnyType, 
'http://www.byjg.com.br', 'ArrayOfAnyType'); 
        RemClassRegistry.RegisterSerializeOptions(ArrayOfAnyType, 
[xoInlineArrays]); 

      end. 

     


Na minha aplicação inseri um componente THTTPRIO e no evento OnCreate do form 
coloquei o código: 

      Código: 

      var 
        H : ConsultaCEPSoap; 
      begin 
        showMessage(H.obterLogradouro('88020-200')); 
      end; 
     


Como fazer?

[As partes desta mensagem que não continham texto foram removidas]



-- 
<<<<< FAVOR REMOVER ESTA PARTE AO RESPONDER ESTA MENSAGEM >>>>>

Para ver as mensagens antigas, acesse:
 http://br.groups.yahoo.com/group/delphi-br/messages

Para falar com o moderador, envie um e-mail para:
 [EMAIL PROTECTED] ou [EMAIL PROTECTED]
 
Links do Yahoo! Grupos

<*> Para visitar o site do seu grupo na web, acesse:
    http://br.groups.yahoo.com/group/delphi-br/

<*> Para sair deste grupo, envie um e-mail para:
    [EMAIL PROTECTED]

<*> O uso que você faz do Yahoo! Grupos está sujeito aos:
    http://br.yahoo.com/info/utos.html

 


Responder a