1

I'm looking the solutions that can do integration between the PHP and Delphi Soap Server. I want to send a file into Delphi SOAP Server via PHP Soap Client. The Delphi server code will be invoked using the TSoapAttachment and the sample code is below :-

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;

Thanks

akunyer
  • 107
  • 11
  • So your actual question is "how can I send a file attachment with PHP SOAP client"? – DaveRandom Jul 27 '12 at 09:11
  • Related: http://stackoverflow.com/questions/1529263/file-attachements-with-php5-soap. A very brief poke around Google on that matter suggests that this simply isn't possible without rolling your own SOAP client for PHP, but I would be happy to be proved wrong on this matter. – DaveRandom Jul 27 '12 at 09:15
  • Yes , sending a file using PHP to Delphi SOAP Server . I'm having trouble in using function UploadFile(afilename: string; afile: TSoapAttachment). How to handle the TSoapAttachment in PHP ? – akunyer Jul 27 '12 at 09:25
  • 3
    This suggests it can be done with NuSOAP: http://stackoverflow.com/questions/2913106/php-soap-transfering-files - the general consensus on the many posts I have now read on the subject seems to be that it cannot be done with the PHP native SOAP client though. – DaveRandom Jul 27 '12 at 09:29

1 Answers1

-1

From another SO post (http://stackoverflow.com/questions/3663416/php-soap-file-upload):
"You can transfer any data you like. You only need to base64 encode the binary data. It will transform it to ascii characters. Then you can transfer it like ordinary string variable. The only think you need to be careful is the server limits."

MB34
  • 4,210
  • 12
  • 59
  • 110