WebServices:Delphi中如何使用Java服务器端的Collection或Vector类型的数据?
写了一个web services
服务器端用java写的 ,通过EJB中从数据库取数据,返回一个Collection,Collection里是对象的集合。
客户端用delphi6写的,但是接收下载的Collection 后不知道怎么处理了。
下面是由wsdl生成的代码:
unit Bean11;
interface
uses InvokeRegistry, Types, XSBuiltIns;
type
Collection = array of Variant; { "java:language_builtins.util" }
Bean1Port = interface(IInvokable)
['{F5223121-92AE-36AF-418C-B1FBC19F89DF}']
function getZxm(const integer: Integer): Collection; stdcall;
function sPrint: String; stdcall;
end;
function GetBean1Port(UseWSDL: Boolean=System.False; Addr: string=''): Bean1Port;
implementation
uses SOAPHTTPClient;
function GetBean1Port(UseWSDL: Boolean; Addr: string): Bean1Port;
const
defWSDL = 'C:\Documents and Settings\df\桌面\新建文件夹\pWebServices\GeneratedWebServiceClients\Bean1_client\pwebservices\generated\Bean1.wsdl';
defURL = 'http://localhost:7001/web-services/Bean1';
defSvc = 'Bean1';
defPrt = 'Bean1Port';
var
RIO: THTTPRIO;
begin
Result := nil;
if (Addr = '') then
begin
if UseWSDL then
Addr := defWSDL
else
Addr := defURL;
end;
RIO := THTTPRIO.Create(nil);
try
if UseWSDL then
begin
RIO.WSDLLocation := Addr;
RIO.Service := defSvc;
RIO.Port := defPrt;
end else
RIO.URL := Addr;
Result := (RIO as Bean1Port);
finally
if Result = nil then
RIO.Free;
end;
end;
initialization
InvRegistry.RegisterInterface(TypeInfo(Bean1Port), 'http://pwebservices', 'UTF-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(Bean1Port), '');
RemClassRegistry.RegisterXSInfo(TypeInfo(Collection), 'java:language_builtins.util', 'Collection');
end.