【发布时间】:2012-07-27 09:08:38
【问题描述】:
我正在寻找可以在 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;
谢谢
【问题讨论】:
-
所以您的实际问题是“如何使用 PHP SOAP 客户端发送文件附件”?
-
相关:stackoverflow.com/questions/1529263/…。对 Google 的简短讨论表明,如果不为 PHP 滚动您自己的 SOAP 客户端,这根本是不可能的,但我很高兴在这件事上被证明是错误的。
-
是的,使用 PHP 向 Delphi SOAP Server 发送文件。我在使用函数 UploadFile(afilename: string; afile: TSoapAttachment) 时遇到问题。如何在 PHP 中处理 TSoapAttachment?
-
这表明它可以用 NuSOAP 完成:stackoverflow.com/questions/2913106/php-soap-transfering-files - 我现在阅读的关于这个主题的许多帖子的普遍共识似乎是它不能用 PHP 原生 SOAP 客户端完成.