Você aplicou Delphi SOAP Runtime and Importer Update? Se não, faça isso! Procure na Internet (Google, AltaVista, etc.) link para download e aplique-o! Depois de aplicá-lo, gere novamente a unit usando o utilitário WSDLImp atualizado (e não o assistente de geração embutido no IDE do Delphi). Provavelmente, isso pode ajudá-lo.
Sds. De: delphi-br@yahoogrupos.com.br [mailto:delphi...@yahoogrupos.com.br] Em nome de Reginaldo Donizete Felix Enviada em: segunda-feira, 20 de julho de 2009 09:18 Para: delphi-br@yahoogrupos.com.br Assunto: [delphi-br] WebService Java + Servidor JBoss + Client Delphi 7 WebService Java + Servidor JBoss + Client Delphi 7 Estou fazendo testes em WebService no JBoss e estou com um problema ao acessar o webservice pelo Delphi. Criei dois metodos no WebService, o primeiro não recebe parametro nenhum so devolve um valor string. O Segundo recebe um parametro String e devolve uma string concatenada. No segundo estou tendo problema na passagem de parâmetro do delphi para o webservice. O seviço esta recebendo null no parametro. Alguem sabe o que pode estar ocorrendo ? Segue o codigo do webservice e o codigo de acesso do delphi: No codigo abaixo a funçao gravar com parametro esta recebendo sempre null no parametro de envio. ------------------------------------------------------- //codigo webservice package com.sistemabancario.servico; import javax.ejb.*; import javax.jws.*; @Stateless @WebService public class GerenteWS implements GerenteWSRemote { public String gravarSemParametro() { // System.out.println("WebService executado no servidor."); // return "ParametroDeRetorno"; } @Override public String gravarComParametro(String envio) { // TODO Auto-generated method stub return envio + " adicionei mais texto no retorno"; } } ---------------------------------------------------------- Codigo Delphi da Classe de Acesso ao WebService // ************************************************************************ // // The types declared in this file were generated from data read from the // WSDL File described below: // WSDL : http://localhost:8080/SistemaBancarioEJB/GerenteWS?wsdl // (20/07/2009 09:59:40 - 1.33.2.5) // ************************************************************************ // unit GerenteWS1; 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 alias...@] 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" // ************************************************************************ // // Namespace : http://servico.sistemabancario.com/ // transport : http://schemas.xmlsoap.org/soap/http // style : document // binding : GerenteWSBinding // service : GerenteWSService // port : GerenteWSPort // URL : http://127.0.0.1:8080/SistemaBancarioEJB/GerenteWS // ************************************************************************ // GerenteWS = interface(IInvokable) ['{4FBA3E30-3C2B-2579-2B43-B1676B2FB70F}'] function gravarComParametro(const arg0: WideString): WideString; stdcall; function gravarSemParametro: WideString; stdcall; end; type TWSGerenteWS = class(TObject) public function gravarSemParametro: WideString; function gravarComParametro(const arg0: WideString): WideString; stdcall; private end; function GetGerenteWS(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): GerenteWS; implementation function TWSGerenteWS.gravarSemParametro: WideString; var RIO: THTTPRIO; ws: GerenteWS; oldSeparator: Char; retorno: WideString; begin try RIO := THTTPRIO.Create(nil); RIO.HTTPWebNode.ConnectTimeout := 100; RIO.HTTPWebNode.SendTimeout := 100; RIO.HTTPWebNode.ReceiveTimeout := 100; ws := GetGerenteWS(false, '', RIO); retorno := ws.gravarSemParametro; result := retorno; Finally end; end; function TWSGerenteWS.gravarComParametro(const arg0: WideString): WideString; var RIO: THTTPRIO; ws: GerenteWS; oldSeparator: Char; retorno: WideString; begin try RIO := THTTPRIO.Create(nil); RIO.HTTPWebNode.ConnectTimeout := 100; RIO.HTTPWebNode.SendTimeout := 100; RIO.HTTPWebNode.ReceiveTimeout := 100; ws := GetGerenteWS(false, '', RIO); retorno := ws.gravarComParametro(arg0); result := retorno; Finally end; end; function GetGerenteWS(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): GerenteWS; const defWSDL = 'http://localhost:8080/SistemaBancarioEJB/GerenteWS?wsdl'; defURL = 'http://127.0.0.1:8080/SistemaBancarioEJB/GerenteWS'; defSvc = 'GerenteWSService'; defPrt = 'GerenteWSPort'; 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 GerenteWS); 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(GerenteWS), ' http://servico.sistemabancario.com/', ''); InvRegistry.RegisterDefaultSOAPAction(TypeInfo(GerenteWS), ''); InvRegistry.RegisterInvokeOptions(TypeInfo(GerenteWS), ioDocument); end. ---------------------------------------------------------- Codigo Delphi da classe de teste unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button: TButton; procedure ButtonClick(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation uses GerenteWS1; {$R *.dfm} procedure TForm1.ButtonClick(Sender: TObject); var GerenteWS : TWSGerenteWS; begin GerenteWS := TWSGerenteWS.create; showmessage(GerenteWs.gravarSemParametro); showmessage(GerenteWS.gravarComParametro('parametro enviado')); end; end. ---------------------------------------------------------- [As partes desta mensagem que não continham texto foram removidas] [As partes desta mensagem que não continham texto foram removidas]