1

PHP と Delphi Soap Server を統合できるソリューションを探しています。PHP SOAP クライアント経由で Delphi SOAP サーバーにファイルを送信したいと考えています。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;

ありがとう

4

1 に答える 1

-1

別の SO 投稿 (http://stackoverflow.com/questions/3663416/php-soap-file-upload) から:
「好きなデータを転送できます。バイナリ データを base64 でエンコードするだけで済みます。 ascii 文字. その後、通常の文字列変数のように転送できます. 注意する必要があるのは、サーバーの制限だけです."

于 2012-07-27T21:58:29.910 に答える