如何将接口类型传递给over过程参数?
type
Hello_PortType = interface(ISoapInvokable)
['{243CBD89-8766-F19D-38DF-427D7A02EAEE}']
function GetDeneme(s: string): string;
end;
SoapCall(Hello_PortType , 'http://localhost:8080/wsdl/ITDeneme');
Run Code Online (Sandbox Code Playgroud)
那么如何使用带有saopcall方法变量的TypeInfo?
function TLib.SoapCall(Intf: Variant; Addr: string): ISoapInvokable;
var
RIO: THTTPRIO;
begin
InvRegistry.RegisterInterface(TypeInfo(Intf), 'urn:DenemeIntf-IDeneme', ''); //-- type info doesn't work with variant
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(Intf), 'GetDeneme');
Result := nil;
if Addr = '' then
exit();
RIO := THTTPRIO.Create(nil);
try
Result := RIO as ISoapInvokable;
RIO.URL := Addr;
finally
if (Result = nil) then
RIO.Free;
end;
end;
Run Code Online (Sandbox Code Playgroud)