我正在寻找可以在 PHP 和 Delphi Soap Server 之间进行集成的解决方案。我想通过 PHP Soap Client 将文件发送到 Delphi SOAP Server。Delphi 服务器代码将使用 TSoapAttachment 调用,示例代码如下:-
Ttextminesvc = class(TInvokableClass, Itextminesvc)
public
.....
protected
function UploadFile(afilename: string; afile: TSoapAttachment): Boolean;
stdcall;
.......
function Ttextminesvc.UploadFile(afilename: string; afile: TSoapAttachment): Boolean;
var ffilename: string;
const pathdir = 'C:\tmp';
begin
result := false;
ffilename := pathdir + afilename;
try
if not directoryexists(pathdir) then
ForceDirectories(pathdir);
except
raise Exception.Create('Unable to create repository directory on the server.');
end;
try
if not fileexists(ffilename) then
begin
afile.SaveToFile(ffilename);
result := true;
end;
except
result := false;
end;
end;
谢谢