|
楼主 |
发表于 2007-1-19 15:50:12
|
显示全部楼层
麻烦你帮我看下,这是我的代码:需要用的方法是“GetDictByName”,但是他返回的结果实际内容是一个数据集,但是在这里是一个类。我该怎么处理?
unit contractdata;
interface
uses InvokeRegistry, Types, XSBuiltIns;
type
GetDictByNameResult = class; { "http://tempuri.org/" }
GetDictByNameResult = class(TRemotable)
private
published
end;
ContractDataSoap = interface(IInvokable)
['{D758CB49-3AA9-4C55-7F6F-DDD7748882AD}']
function GetDictByName(const DictName: String): GetDictByNameResult; stdcall;
end;
function GetContractDataSoap(UseWSDL: Boolean; Addr: string): ContractDataSoap;
implementation
uses SOAPHTTPClient;
function GetContractDataSoap(UseWSDL: Boolean; Addr: string): ContractDataSoap;
const
defWSDL = 'http://10.232.20.121/sgmis/contract/contractdata.asmx?wsdl';
defURL = 'http://10.232.20.121/sgmis/contract/contractdata.asmx';
defSvc = 'ContractData';
defPrt = 'ContractDataSoap';
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;
RIO.HTTPWebNode.UseUTF8InHeader := true;
Result := (RIO as ContractDataSoap);
finally
if Result = nil then
RIO.Free;
end;
end;
initialization
InvRegistry.RegisterInterface(TypeInfo(ContractDataSoap), 'http://tempuri.org/', 'utf-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(ContractDataSoap), 'http://tempuri.org/%operationName%');
InvRegistry.RegisterInvokeOptions(TypeInfo(ContractDataSoap), ioDocument);
RemClassRegistry.RegisterXSClass(GetDictByNameResult, 'http://tempuri.org/', 'GetDictByNameResult');
end. |
|