为什么我用Delphi6调用c#编写的WebService时总是提示"参数错误".(100分)

  • 主题发起人 主题发起人 koy0755
  • 开始时间 开始时间
K

koy0755

Unregistered / Unconfirmed
GUEST, unregistred user!
c#代码:
.....
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}

[WebMethod]
public int Adds(int a,int b)
{
return a+b;
}
....


Delphi代码
生成接口:
uses Types, XSBuiltIns, Unit2;
type

SeSoap = interface(IInvokable)
['{B9B6D74A-364C-4867-BD55-41C39BF9FEA8}']
procedure HelloWorld(var parameters: HelloWorld); stdcall;
procedure Adds(var parameters: Adds); stdcall;
end;
======================================================
HelloWorld = class(TRemotable)
end;

{ HelloWorldResponse }

HelloWorldResponse = class(TRemotable)
private
FHelloWorldResult: WideString;
published
property HelloWorldResult: WideString read FHelloWorldResult write FHelloWorldResult;
end;

{ Adds }

Adds = class(TRemotable)
private
Fa: Integer;
Fb: Integer;
published
property a: Integer read Fa write Fa;
property b: Integer read Fb write Fb;
end;
=========================================
调用的代码
var
se:SeSoap;
hw:Helloworld;
ad:Adds;
begin
try
ad:=Adds.Create;
hw:=helloworld.Create;
se:=self.httprio1 as SeSoap;
// se.HelloWorld(hw);//一调用就出错
ad.a:=10;
ad.b:=11;
se.Adds(ad);//一调用Webservice就出错.
Showmessage('dk');
finally
hw.Free;
ad.Free;
end;

//如果有Delphi6调用.net的WebService的成功例子能发给我就最好.
yzp0755@163.com
 
后退
顶部