Doubt in SOAP with DIME attachments!

I

Ipsita

Hi!

I was going through the WSE 2.0 documentation to try SOAP with DIME
attachments. The example shows the server sending an image file and
the client displaying it in a picture box control. How do I do it, if
the server has to say eg a doc/text/pdf file and the client has to
read that and show that in a textbox control. Also how will the client
save it on to its local machine.

Please help me in this matter.

Thanks
Ipsita
 
D

Dan Rogers

Hi Ipsita,

When you consider that display of a particular file types requires the
appropriate display target (e.g. a picture box for a picture, an instance
of word for a word document, and an instance of Acrobat Reader for PDF
files, etc, I doubt that you'll be successful in displaying every
non-picture file type in a text box.

If you think about how the web browser might be able to associate the files
it receives from an HTTP GET request and launch the right viewers, you can
observe that the first thing that happens is that the file is saved to
disk. And then a shellExecute win32 call is launched, passing the file
name, including its extension. The normal windows extension mechanism does
the rest.

For a .Net client, writing the file is simple - you could use a
streamwriter, or whatever is appropriate. Don't use a textwriter to write
a binary file, however. Then to launch the right viewer, you need to
launch the right reader (e.g.)
System.Diagnostics.Process.Start(new
System.Diagnostics.ProcessStartInfo(path));
Passing the right path to the file you've written.

If you have a control that is compatible with the data you received in the
attachment, such as a text box for a unicode string, you can direclty
assign the instance of the data to the control. You cannot just assign a
binary word document in memory to a text box, however, as you would need a
special control that has a property that is capable of decoding a word
document file from an in memory instance.

I hope this helps

Dan Rogers
Microsoft Corporation
--------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,737
Latest member
Georgeengab

Latest Threads

Top