Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Can a web service return a file?

Reply
Thread Tools

Can a web service return a file?

 
 
Uzi
Guest
Posts: n/a
 
      06-23-2006
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

 
Reply With Quote
 
 
 
 
Josh Twist
Guest
Posts: n/a
 
      06-23-2006
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


 
Reply With Quote
 
 
 
 
Michel Posseth [MCP]
Guest
Posts: n/a
 
      06-24-2006
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" <(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed) 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

>



 
Reply With Quote
 
Josh Twist
Guest
Posts: n/a
 
      06-24-2006
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" <(E-Mail Removed)> schreef in bericht
> news:(E-Mail Removed) 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

> >


 
Reply With Quote
 
Michel Posseth [MCP]
Guest
Posts: n/a
 
      06-25-2006
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" <(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed) 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" <(E-Mail Removed)> schreef in bericht
>> news:(E-Mail Removed) 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
>> >

>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Does timer in Web Service Global.asax block my Web Service from processing web-site requests? Leo Violette ASP .Net Web Services 0 04-17-2009 12:39 AM
How can I return an HTTP 403 status from a web service? adamcrume@gmail.com Java 9 06-18-2008 04:23 AM
How can I remove XML tags from ASP.NET web service return values? DonaldN ASP .Net Web Services 1 02-17-2006 08:42 AM
InvocationTargetException when calling "new Service()" in Axis web service to call another web service Michael Averstegge Java 0 01-10-2006 11:05 PM
what value does lack of return or empty "return;" return Greenhorn C Programming 15 03-06-2005 08:19 PM



Advertisments