Solved

Transfering files from a web service to a win 32 client

Posted on 2010-11-18
2
1,269 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
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…

691 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