Hello,
I have created a Web service with the following web method;
<WebMethod()> _
Public Function HelloWorld(ByVal myMemoryStream As
System.IO.MemoryStream) As String
Return "Hello World"
End Function
I have also created a Web application with the following subroutine;
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim mySample As New localhost.Sample
Response.Write(mySample.HelloWorld(Response.OutputStream))
End Sub
Line 2 of the Page_Load sub generates the error; Value of type
'System.IO.Stream' cannot be converted to
'Sample_Debug.localhost.MemoryStream'.
What should I do to fix this?
Thanks,
Jason.
Keenan Newton - 14 Feb 2005 15:46 GMT
Well to the best of my knowledge you can not pass a memory stream. i
won't serialize on its own, so I think web serivces will have issues
with it, but you can convert the memory stream to a byte array with the
ToArray method pass that through the web service, and then put it back
into a memorystream (one of the constructor overloads accepts a byte
array). However i have to be honest I am not sure if trying to move
memory stream acros a web service is wise in the first place. But then
again I don't know what you are trying to accomplish
Jason Taylor - 20 Feb 2005 22:29 GMT
Thanks Keenan, have taken an alternate solution.
Cheers,
Jason
Richard - 18 Jun 2005 04:43 GMT
Could please tell me what alternative method you are using?
> Thanks Keenan, have taken an alternate solution.
>
> Cheers,
>
> Jason