例如:  public aa(String name,details)  返回一个aa对象,参数 字符型的name 和  details(对象数组) 现在是这样的,1、在delphi中如何定义 一个返回类型的对象把aa的值付给我自己定义的对象。2、delphi中 返回details型对象数组如何传递参数。 就着两个问题,谢谢了。
 QQ:18399559
 MSN:[email protected]

解决方案 »

  1.   

    用 delphi 的 new->webservice-> wsdl importer 导入那个 wsdl 就会生成那个对像的描术, 可能会生成如下类似东东(你手动作也是可以的)TsomeObject = class(TRemotable)
    published
      property xxx: TSomeType read Fxxx write Fxxx;
    end;TArrayOfSomeObject = array of TSomeObject;以下是我的一个导出类  // ************************************************************************ //
      // Namespace : ET
      // ************************************************************************ //
      TLine = class(TRemotable)
      private
        FName: WideString;
        FVoltage: Integer;
      published
        property Name: WideString read FName write FName;
        property Voltage: Integer read FVoltage write FVoltage;
      end;  TLineArray = array of TLine;                  { "urn:ETObjectIntf" }  // ************************************************************************ //
      // Namespace : urn:CategoryIntf-ILineMgr
      // soapAction: urn:CategoryIntf-ILineMgr#%operationName%
      // transport : http://schemas.xmlsoap.org/soap/http
      // style     : rpc
      // binding   : ILineMgrbinding
      // service   : ILineMgrservice
      // port      : ILineMgrPort
      // URL       : http://127.0.0.1:8081/ETSrvDBG.ETDBG/soap/ILineMgr
      // ************************************************************************ //
      ILineMgr = interface(IInvokable)
      ['{6CF0A2E0-FF92-1911-8AA5-A0CC6B951C0A}']
        function  List: TLineArray; stdcall;
        procedure Append(var Value: TLine); stdcall;
        procedure Change(const Id: Integer; const Value: TLine); stdcall;
      end;而我实际定义的  { 所有基础数据基类 }
      
      TETObject = class(TRemotable)
      private
        FId: Integer;
      published
        property Id: Integer read FId write FId;
      end;  { 分类对像基类 }  TCategoryObject = class(TETObject)
      private
        FSortIdx: Integer;
      published
        property SortIdx: Integer read FSortIdx write FSortIdx;
      end;  { 线路 }  TLine = class(TCategoryObject)
      private
        FName: string;
        FVoltage: Integer;
      public
        constructor Create; override;
        destructor Destroy; override;
      published
        property Name: string read FName write FName;
        property Voltage: Integer read FVoltage write FVoltage;
      end;  TLineArray = array of TLine;
      

  2.   

    看得出来是支持多态的, 因为我是 delphi 对像定义文件本身就可以用, 所以我是在用到的单元中 use 这我自写的定义类就好, 看你的东东不是 delphi 服务端, 因此这个描述文件可能要导出后自写了搞不搞得明白就是以上内容了现在说调用details: TSomeObjectArray;SetLength(Details, 10);
    for i := 0 to 9 do
      Details[i] := TSomeObject.Create;这里就可以设值后调用了, 但是完成后要显示释放for i := 0 to 9 do
      Details[i].Free;
      

  3.   

    我的方法是:
      
             function aa(const in0: WideString; const in1: WideString; const in2: WideString; const in3: Integer; const in4: ArrayOfPropertyData): OperateResult; stdcall;
            aa是个对象,ArrayOfPropertyData是个对象数组,我现在是想用delphi调用一下这个函数。现在怎么做??
      

  4.   

    var
      in4: ArrayOfPropertyData
    begin
      ...
      
      SetLength(in4, 某len);
      for i := 0 to 某len-1
      begin
        in4[i] := PropertyData.Create;
        in4[i].xxx := xxx
      end;  调用  for i := 0 to 某len-1
        in4[i].Free;
      ...
    end;
      

  5.   

    我感谢comanche(太可怕)朋友的帮忙 请问如何在dephi中定义一个返回对象?
    function aa(const in0: WideString; const in1: WideString; const in2: WideString; const in3: Integer; const in4: ArrayOfPropertyData): OperateResult; stdcall主要是aa的返回对象??
      

  6.   

    问题解决了,直接定义如下:
    Temp: TObject
      

  7.   

    procedure TForm1.Button4Click(Sender: TObject);
    var
     sql:String;
     i:Integer;
     Temp: TObject;
      details: ArrayOfPropertyData;
    begin    SetLength(Details,10);
        for i:=0 to 9 do
         begin
            Details[i]:= PropertyData.Create ;
            Details[i].name:='YES';
            Details[i].value:='NO';
          end;
        sql:=run.example('sdfsdf');
        ShowMessage(sql);
        Temp:=run.manageProduct('a','b','c',1,Details) ;//此句为什么有错误??