23

错误出现在ShowMessage(aServer.mc_version)此代码的行中:

uses mantisconnect;

procedure TForm.Button1Click(Sender: TObject);
var
   aServer: MantisConnectPortType;
begin
   aServer := GetMantisConnectPortType;
   ShowMessage('Mantis version:' + aServer.mc_version);
end;

相同的代码在Delphi XE5上运行,但在Delphi XE6上编译第一次触发错误(第一次点击按钮),但下次运行:

The system cannot find the file specified 
URL:http://www.mymantis.com/api/soap/mantisconnect.php - 
SOAPAction: URL:http://www.mymantis.com/api/soap/mantisconnect.php/mc_version

如果我再试一次(第二次点击按钮)它会起作用!输出:

Mantis version:1.2.9

连接过程的清单是

function GetMantisConnectPortType(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): MantisConnectPortType;
const
  defWSDL = 'http://www.mymantis.com/api/soap/mantisconnect.php?wsdl';
  defURL  = 'http://www.mymantis.com/api/soap/mantisconnect.php';
  defSvc  = 'MantisConnect';
  defPrt  = 'MantisConnectPort';
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;
  try
    Result := (RIO as MantisConnectPortType);
    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;

mc_version是一部分

MantisConnectPortType = interface(IInvokable)

并声明:

function  mc_version: string; stdcall;
4

0 回答 0