写了一个web services
服务器端用java写的 ,通过EJB中从数据库取数据,返回一个Collection,Collection里是对象的集合。
客户端用delphi6写的,但是接收下载的Collection 后不知道怎么处理了。下面是由wsdl生成的代码:
unit Bean11;interfaceuses 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.

解决方案 »

  1.   

    最好用数组...............在delphi里没有向量这个类型,如果你要实现的话需要自已写一个vector的类!!!!!!!!!!!!!
      

  2.   

    服务器端取数据的方法:
    public Collection getZxm(Integer gsxh){
        Collection result=new Vector();
        try{
         Context ctx = new InitialContext();
         Object ref = ctx.lookup("XtglSession");     XtglSessionHome xtglSessionHome = (XtglSessionHome)PortableRemoteObject.narrow(ref,XtglSessionHome.class);
         XtglSession xtglSession = xtglSessionHome.create();     Iterator loValue = xtglSession.getAllZxm(gsxh).iterator();
         ZxmObject zo = null;
         for(;loValue.hasNext();){
           zo = (ZxmObject)loValue.next();
           result.add(zo);
         }
       }catch(Exception ex){
          ex.printStackTrace();
        }
        return result;
      }
      

  3.   

    vector... 向量。。类似动态数组 功能很强大
    可以参考 TList的实现