Can a web service return a file?

U

Uzi

Hi all,

My web service does some work on a remote machine. A file is created on
the remote machine as a result of this work.
How do I return this file to the web service client on the local
machine?

Thaks,

Uzi
 
M

Michel Posseth [MCP]

You can do this simpeler and platform independent

take the file as a binary stream , now encodebase64 this stream ( you gat
a string in return )

now pass this string to the other side , on the other side you can perform a
decodebas64 on the string and output it to a file

this way you can send anything you want over the wire ( executables , word
documents etc etc etc )

In my reallife situation i created a custom XML with a filename tag , a
description tag and a data tag ( the one containing the enocoded data )
this way the receiver does not have to guess the file name or type


regards

Michel Posseth [MCP]


Josh Twist said:
Hi Uzi,

You could read all bytes and return it as a byte[] array or you could
look at MTOM provided by MS in Web Service Extensions 3.0.

http://msdn.microsoft.com/webservices/webservices/building/wse/default.aspx

Josh
http://www.thejoyofcode.com/
Hi all,

My web service does some work on a remote machine. A file is created on
the remote machine as a result of this work.
How do I return this file to the web service client on the local
machine?

Thaks,

Uzi
 
J

Josh Twist

ASP.NET Web Services automatically serialise byte[] into base64 - so
there's no need to do it yourself.

Josh
http://www.thejoyofcode.com/

You can do this simpeler and platform independent

take the file as a binary stream , now encodebase64 this stream ( you gat
a string in return )

now pass this string to the other side , on the other side you can perform a
decodebas64 on the string and output it to a file

this way you can send anything you want over the wire ( executables , word
documents etc etc etc )

In my reallife situation i created a custom XML with a filename tag , a
description tag and a data tag ( the one containing the enocoded data )
this way the receiver does not have to guess the file name or type


regards

Michel Posseth [MCP]


Josh Twist said:
Hi Uzi,

You could read all bytes and return it as a byte[] array or you could
look at MTOM provided by MS in Web Service Extensions 3.0.

http://msdn.microsoft.com/webservices/webservices/building/wse/default.aspx

Josh
http://www.thejoyofcode.com/
Hi all,

My web service does some work on a remote machine. A file is created on
the remote machine as a result of this work.
How do I return this file to the web service client on the local
machine?

Thaks,

Uzi
 
M

Michel Posseth [MCP]

I did know that between .Net and .Net you can send byte data ( and then
ofcourse it must be represented in some form of string format in the
transmission )

However i wrote this service first with the 2002 version ( don`t know if it
did work with this version to )
also an advantage i have now is that i send this in a custom XML file where
i can tell to the client what the enclosing data represents
and the fact that i exchange this data with clients written in Delphi and
progress ( unix )

Michel



Josh Twist said:
ASP.NET Web Services automatically serialise byte[] into base64 - so
there's no need to do it yourself.

Josh
http://www.thejoyofcode.com/

You can do this simpeler and platform independent

take the file as a binary stream , now encodebase64 this stream ( you
gat
a string in return )

now pass this string to the other side , on the other side you can
perform a
decodebas64 on the string and output it to a file

this way you can send anything you want over the wire ( executables ,
word
documents etc etc etc )

In my reallife situation i created a custom XML with a filename tag , a
description tag and a data tag ( the one containing the enocoded data )
this way the receiver does not have to guess the file name or type


regards

Michel Posseth [MCP]


Josh Twist said:
Hi Uzi,

You could read all bytes and return it as a byte[] array or you could
look at MTOM provided by MS in Web Service Extensions 3.0.

http://msdn.microsoft.com/webservices/webservices/building/wse/default.aspx

Josh
http://www.thejoyofcode.com/

Uzi wrote:
Hi all,

My web service does some work on a remote machine. A file is created
on
the remote machine as a result of this work.
How do I return this file to the web service client on the local
machine?

Thaks,

Uzi
 

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,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top