Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Services (http://www.velocityreviews.com/forums/f64-asp-net-web-services.html)
-   -   Can a web service return a file? (http://www.velocityreviews.com/forums/t786293-can-a-web-service-return-a-file.html)

Uzi 06-23-2006 08:23 AM

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


Josh Twist 06-23-2006 03:37 PM

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



Michel Posseth [MCP] 06-24-2006 08:25 AM

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

>




Josh Twist 06-24-2006 01:20 PM

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

> >



Michel Posseth [MCP] 06-25-2006 04:36 PM

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.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57