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.