![]() |
Can a web service return a file?
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 |
Re: Can a web service return a file?
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/webservice...e/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 |
Re: Can a web service return a file?
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" <josh.twist@gmail.com> schreef in bericht news:1151077036.384194.212480@b68g2000cwa.googlegr oups.com... > 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/webservice...e/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 > |
Re: Can a web service return a file?
ASP.NET Web Services automatically serialise byte[] into base64 - so
there's no need to do it yourself. Josh http://www.thejoyofcode.com/ Michel Posseth [MCP] wrote: > 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" <josh.twist@gmail.com> schreef in bericht > news:1151077036.384194.212480@b68g2000cwa.googlegr oups.com... > > 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/webservice...e/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 > > |
Re: Can a web service return a file?
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" <josh.twist@gmail.com> schreef in bericht news:1151155244.990104.202680@c74g2000cwc.googlegr oups.com... > ASP.NET Web Services automatically serialise byte[] into base64 - so > there's no need to do it yourself. > > Josh > http://www.thejoyofcode.com/ > > > Michel Posseth [MCP] wrote: >> 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" <josh.twist@gmail.com> schreef in bericht >> news:1151077036.384194.212480@b68g2000cwa.googlegr oups.com... >> > 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/webservice...e/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 >> > > |
| All times are GMT. The time now is 03:15 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.