我已经导入了 WSDL(使用自动版本检测...),现在当我尝试使用它时,我收到类似于“顶级节点丢失,行:0”的错误,我花了很多时间在 google 上寻找解决方案,我发现很多人都遇到过同样的问题,但我找不到解决方案。
我很确定很多开发人员已经解决了这个问题,所以我的问题是如何?!
导入 WSDL 后,它会生成主界面,其中包含辅助方法和返回主界面的特殊函数,例如:
type
array_of_string = array of string;
ASpecialInterface = interface(IInvokable)
//...
function ASpecialMethod(const dummyArg: string): array_of_string; stdcall;
//...
end;
以及返回 ASpecialInterface 的方法,例如:
function GetASpecialInterface(const UseWSDL: Boolean; const addr: string; const ahttprio: THTTPRio): ASpecialInterface;
这是我的问题:
procedure TMyForm.OnAButtonClick(Sender: Tobject);
var
LArrayOfString: array_of_string;
LSpecialIntf: ASpecialInterface;
begin
// this works without any issue whatsoever
LSpecialIntf := GetASpecialInterface; // I call it with default params
// the next code raises the exception mentioned above
LArrayOfString := LSpecialIntf.ASpecialMethod(EmptyStr); // no param passed since the dummyArg is dummy
end;
现在,我不确定这是否有值(value),但连接是使用 SSL 建立的,即 https://domain.com/ ...
编辑:抱歉,忘了提及我正在使用 Delphi 2010
感谢大家抽出时间。
最佳答案
在 Delphi 2010 中,soaphttptrans.pas 中存在错误。当由于某种原因找不到服务器时,您得到的异常是 EDOMParseError 而不是像以前一样的 ESOAPHTTPException。更多信息可以在这里找到:https://forums.embarcadero.com/thread.jspa?threadID=44545&tstart=0
关于delphi - 缺少 SOAP 顶级节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4837202/