Solved

Transfering files from a web service to a win 32 client

Posted on 2010-11-18
2
1,231 Views
Last Modified: 2012-06-21
Hello,

For demonstration purposes I would like to be able to transfer a binary file from a directory on a web server to a Win 32 client application.

Can anyone point me in the right direction.  I have seen lots of examples for .Net but i want to do this in Win32 using Delphi 2010.

I can write the application and the web service... but i am not sure about the file transfer bit over soap.

0
Comment
Question by:soozh
2 Comments
 
LVL 7

Assisted Solution

by:ebob42
ebob42 earned 250 total points
ID: 34164450
Take a look at SOAP attachements (assuming your server and client are both written in Delphi).

Server side:

    function GetBinaryFile: TSOAPAttachment; stdcall;

implementation:

function TSourceCode.GetBinaryFile: TSOAPAttachment;
var
  FileStream: TFileStream;
begin
    Result := TSOAPAttachment.Create;
    FileStream := TFileStream.Create(YourRemoteFileName),  fmOpenRead or fmShareDenyNone);
    Result.SetSourceStream(FileStream);
end;

Client side usage:

var
  SoapAttachment: TSoapAttachment;
begin
  try
    SoapAttachment := SourceCode.GetBinaryFile;
    SoapAttachment.SaveToFile(LocalFileName)
  finally
    SoapAttachment.Free
  end
0
 
LVL 2

Accepted Solution

by:
MaximKorobov earned 250 total points
ID: 34239189
If you mean download file from web server to your local PC, you can use included INDY internet controls.

Example with progress bar implementation: http://stackoverflow.com/questions/2184473/download-a-file-from-internet-programatically-with-an-progress-event-using-delph
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
This video teaches users how to migrate an existing Wordpress website to a new domain.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now