Pessoal estou tentando acesar um Web Sevice com o delphi
e nao estou conseguindo..


O Web Service Criei em PHP ..

so que nao sei charmar a funcao listarFuncionarios no Delphi !!!

esta unit foi criada com base no Web Service , atravaz do componente
WSDLImporter .


fiz varios testes malucos mas nada funciona ...

fun := wsFuncionario.Funcionario.Create;


Alguem sabe algo sobre o assunto ???


vai ter que mostrar um array de funcionarios








// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL     : http://www.comercial.sulfabril.com.br/ws/wsFuncionario.php?wsdl
// Encoding : ISO-8859-1
// Codegen  : [wfDebug,wfUseSerializerClassForAttrs]
// Version  : 1.0
// (8/2/2008 14:40:28 - 1.33.2.5)
// ************************************************************************ //

unit wsFuncionario;

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";
   // !:float           - "http://www.w3.org/2001/XMLSchema";

   Funcionario          = class;                 { "urn:server.wsFuncionario" }



   // 
************************************************************************ //
   // Namespace : urn:server.wsFuncionario
   // 
************************************************************************ //
   Funcionario = class(TRemotable)
   private
     Fmatricula: WideString;
     Fnome: WideString;
     Fsalario: Single;
   published
     property matricula: WideString read Fmatricula write Fmatricula;
     property nome: WideString read Fnome write Fnome;
     property salario: Single read Fsalario write Fsalario;
   end;

   ArrayOfFuncionario = array of Funcionario;    { "urn:server.wsFuncionario" }

   // 
************************************************************************ //
   // Name      : server.wsFuncionarioPortType
   // Namespace : urn:server.wsFuncionario
   // soapAction: urn:server.wsFuncionario#listarFuncionarios
   // transport : http://schemas.xmlsoap.org/soap/http
   // style     : rpc
   // binding   : server.wsFuncionarioBinding
   // service   : server.wsFuncionario
   // port      : server.wsFuncionarioPort
   // URL       : http://www.comercial.sulfabril.com.br/ws/wsFuncionario.php
   // 
************************************************************************ //
   server_wsFuncionarioPortType = interface(IInvokable)
   ['{47D29D31-42DA-02E4-C7E5-5124A63D8D3B}']
     function  listarFuncionarios: ArrayOfFuncionario; stdcall;
   end;

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


implementation

function Getserver_wsFuncionarioPortType(UseWSDL: Boolean; Addr: string; 
HTTPRIO: THTTPRIO): server_wsFuncionarioPortType;
const
   defWSDL = 'http://www.comercial.sulfabril.com.br/ws/wsFuncionario.php?wsdl';
   defURL  = 'http://www.comercial.sulfabril.com.br/ws/wsFuncionario.php';
   defSvc  = 'server.wsFuncionario';
   defPrt  = 'server.wsFuncionarioPort';
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 server_wsFuncionarioPortType);
     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(server_wsFuncionarioPortType), 
'urn:server.wsFuncionario', 'ISO-8859-1', '', 'server.wsFuncionarioPortType');
   
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(server_wsFuncionarioPortType), 
'urn:server.wsFuncionario#listarFuncionarios');
   RemClassRegistry.RegisterXSClass(Funcionario, 
'urn:server.wsFuncionario', 'Funcionario');
   RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfFuncionario), 
'urn:server.wsFuncionario', 'ArrayOfFuncionario');

end.


+========================================================================================
 

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

Responder a