错误显示在此代码的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;