以下代码中:Result := (RIO as SMSInterface); 这句有时会返回nil,不知是什么原因?请各位大侠赐教。unit uSMSInterface;interfaceuses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;type  // ************************************************************************ //
  // The following types, referred to in the WSDL document are not being represented
  // in this file. They are either aliases[@] of other types represented or were referred
  // to but never[!] declared in the document. The types from the latter category
  // typically map to predefined/known XML or Borland types; however, they could also 
  // indicate incorrect WSDL documents that failed to declare or import a schema type.
  // ************************************************************************ //
  // !:string          - "http://www.w3.org/2001/XMLSchema"
  // !:int             - "http://www.w3.org/2001/XMLSchema"
  // !:boolean         - "http://www.w3.org/2001/XMLSchema"
  // ************************************************************************ //
  // Namespace : http://DefaultNamespace
  // transport : http://schemas.xmlsoap.org/soap/http
  // style     : rpc
  // binding   : SMSInterfaceSoapBinding
  // service   : SMSInterfaceService
  // port      : SMSInterface
  // URL       : http://192.168.4.22:8000/SMSInterface.jws
  // ************************************************************************ //
  SMSInterface = interface(IInvokable)
  ['{F601AA1B-D865-BA8E-AF68-04E0F4409E67}']
    function  SMSInterface(const strVersion: WideString; const strIntfData: WideString; const strSMSCode: WideString; const strSignature: WideString): WideString; stdcall;
    function  exec(const strVersion: WideString; const strIntfData: WideString; const strSMSCode: WideString; const strSignature: WideString): WideString; stdcall;
    function  getID: Integer; stdcall;
    procedure setID(const id: Integer); stdcall;
    function  getVersion: WideString; stdcall;
    function  isForVirtualUser: Boolean; stdcall;
    function  getSMSCode: WideString; stdcall;
    function  getIntfData: WideString; stdcall;
    function  getCommandType: WideString; stdcall;
    function  getReturnCode: Integer; stdcall;
    function  getReturnDesc: WideString; stdcall;
  end;function GetSMSInterface(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): SMSInterface;
implementationfunction GetSMSInterface(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): SMSInterface;
const
  defWSDL = 'http://192.168.4.22:8000/SMSInterface.jws?wsdl';
  defURL  = 'http://192.168.4.22:8000/SMSInterface.jws';
  defSvc  = 'SMSInterfaceService';
  defPrt  = 'SMSInterface';
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.UseUTF8InHeader:=true;
  try
    Result := (RIO as SMSInterface);
    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;
initialization
  InvRegistry.RegisterInterface(TypeInfo(SMSInterface), 'http://DefaultNamespace', 'UTF-8');
  InvRegistry.RegisterDefaultSOAPAction(TypeInfo(SMSInterface), '');end.