470,632 Members | 2,454 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,632 developers. It's quick & easy.

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

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
Nov 23 '05 #1
7 3005
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

Nov 23 '05 #2
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...b;en-us;326791

HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com
http://www.geniant.com
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


Nov 23 '05 #3
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?

"Keenan Newton" <ka*********@yahoo.com> wrote in message news:<11**********************@c13g2000cwb.googleg roups.com>...
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

Nov 23 '05 #4
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?

"Keenan Newton" <ka*********@yahoo.com> wrote in message news:<11**********************@c13g2000cwb.googleg roups.com>...
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

Nov 23 '05 #5
Thanks for your reply.

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

Dilip Krishnan <dk*******@NOSPAM.geniant.com> wrote in message news:<32**********************@msnews.microsoft.co m>...
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...b;en-us;326791

HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com
http://www.geniant.com
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

Nov 23 '05 #6
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/is...s/default.aspx

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

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

Dilip Krishnan <dk*******@NOSPAM.geniant.com> wrote in message
news:<32**********************@msnews.microsoft.co m>...
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...b;en-us;326791

HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com
http://www.geniant.com
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


Nov 23 '05 #7
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.

Nov 23 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by David | last post: by
1 post views Thread by woodpecker woodpecker | last post: by
reply views Thread by Fahad | last post: by
reply views Thread by perschrotti | last post: by
2 posts views Thread by jack | last post: by
1 post views Thread by Mahesh Devjibhai Dhola | last post: by
reply views Thread by Rado | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.