Solved

Transfering files from a web service to a win 32 client

Posted on 2010-11-18
2
1,235 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

937 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

10 Experts available now in Live!

Get 1:1 Help Now