Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / February 2005

Tip: Looking for answers? Try searching our database.

Streaming from webservice problem. This should be chicken feed for WS developers.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
redraven - 15 Feb 2005 17:14 GMT
Hi,

I have a webservice with a method that returns an instance of
System.IO.MemoryStream.

For example:
[WebMethod]
public MemoryStream myMeth()
{
  return new MemoryStream();
}

When I call that method from the client,

MemoryStream ms = myWS.myMeth();

I receive a type cast error ("Cannot implicitly convert type
'myWS.localhost.MemoryStream' to 'System.IO.MemoryStream"). I've tried
explicitly casting it to System.IO.MemoryStream, but to no avail.

Btw. I'm trying to stream data from WS to client. Not sure if
MemoryStream is the best way of doing it

Any help or guidance would be appreciated greatly.

Thanks,
Andre
Keenan Newton - 16 Feb 2005 00:01 GMT
I am not sure if you ahve posted this before on another newsgroup, but
I would convert the MemoryStream to a byte array and pss the byte array
to the client from there you can convert the byte array back into a
MemoryStream
redraven - 16 Feb 2005 10:05 GMT
What if the byte arry is gigantic?
Is there a way to actaully stream the array? Or will HTTP/SOAP take
care of the streaming?

> I am not sure if you ahve posted this before on another newsgroup, but
> I would convert the MemoryStream to a byte array and pss the byte array
> to the client from there you can convert the byte array back into a
> MemoryStream
redraven - 16 Feb 2005 10:06 GMT
What if the byte arry is gigantic?
Is there a way to actaully stream the array? Or will HTTP/SOAP take
care of the streaming?

> I am not sure if you ahve posted this before on another newsgroup, but
> I would convert the MemoryStream to a byte array and pss the byte array
> to the client from there you can convert the byte array back into a
> MemoryStream
Dilip Krishnan - 16 Feb 2005 05:10 GMT
Hello redraven,
These [0] are the supported data types. Anything else that you send accross
the wire must be 'XmlSerializable'

[0] http://support.microsoft.com/default.aspx?scid=kb;en-us;326791 

HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com
http://www.geniant.com

> Hi,
>
[quoted text clipped - 22 lines]
> Thanks,
> Andre
redraven - 16 Feb 2005 12:52 GMT
Thanks for your reply.

What is the best way then to stream loads of data with a WS?

> Hello redraven,
> These [0] are the supported data types. Anything else that you send accross
[quoted text clipped - 35 lines]
> > Thanks,
> > Andre
Dilip Krishnan - 16 Feb 2005 14:50 GMT
Hello redraven,
  You cannot stream data. if you have large files then you would need to
use DIME [0] attachments or just send data as base64 encoded bytes

[0] - http://msdn.microsoft.com/msdnmag/issues/03/05/XMLFiles/default.aspx

HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com
http://www.geniant.com

> Thanks for your reply.
>
[quoted text clipped - 38 lines]
>>> Thanks,
>>> Andre
Keenan Newton - 16 Feb 2005 15:59 GMT
It won't matter if it is "gigantic", however your other options are to
convert it base64, which i think would have a bigger foot print then a
byte array or use WS-Attachments with WSE 2.0.  Again  I think the
easiest way in your case is the byte array.  Why don't you create a
simple web service and try out the differences.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.