Delphi XE 6 - SOAP request HTTPRIO error: The system cannot find the file specified
Asked Answered
B

0

26

The error appears in the ShowMessage(aServer.mc_version) line of this code:

uses mantisconnect;

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

The same code works on Delphi XE5, but compiled on Delphi XE6 triggers an error the first time (first click on the button), but it works the next time:

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

If I try again (second click on the button) it works! Output:

Mantis version:1.2.9

Listing of the connection procedure is

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 is a part of

MantisConnectPortType = interface(IInvokable)

and has the declaration:

function  mc_version: string; stdcall;
Brainchild answered 9/6, 2014 at 9:1 Comment(4)
I guess yes but, have you tried reimporting the SOAP service? It might have something to do with the changes they applied in XE6 to the SOAP units.False
yes, I tried ... making debugging it seems that the bug is in the XE6 soap unitBrainchild
It seems to be a bug in XE6: qc.embarcadero.com/wc/qcmain.aspx?d=124627 (the "Steps to Reproduce" section also shows how it can be fixed)Manful
Has this since been fixed in newer versions of Delphi? Maybe close this question or write an answer saying it's been fixed?Socha

© 2022 - 2024 — McMap. All rights reserved.