高分求正确使用RIO.HTTPWebNode.ConnectTimeout的方法(即设置WebService客户端超时)
以下是WSDL产生的框架代码
function GetCommonWebServicePortType(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): CommonWebServicePortType;
const
defWSDL = 'C:\Documents and Settings\Administrator\桌面\CommonWebService.xml';
defURL = 'http://localhost:8080/xxx/service/CommonWebService';
defSvc = 'CommonWebService';
defPrt = 'CommonWebServiceHttpPort';
var
RIO: THTTPRIO;
begin
Result := nil;
if (Addr = '') then
begin
if UseWSDL then
Addr := defWSDL
else
Addr := defURL;
end;
if HTTPRIO = nil then
RIO := THTTPRIO.Create(nil)
else
RIO := HTTPRIO;
RIO.HTTPWebNode.ConnectTimeout := 10000; //<<--该句是我加的
try
Result := (RIO as CommonWebServicePortType);
if UseWSDL then
begin
RIO.WSDLLocation := Addr;
RIO.Service := defSvc;
RIO.Port := defPrt;
end else
RIO.URL := Addr;
finally
if (Result = nil) and (HTTPRIO = nil) then
RIO.Free;
end;
end;
如上,当我使用RIO.HTTPWebNode.ConnectTimeout设置SOAP超时时,弹出错误“传递给系统调用的数据区域太小”,去GOOGLE也一无所获,只得求助CSDN高手了。