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 / June 2005

Tip: Looking for answers? Try searching our database.

Passing MemoryStream ByRef Issue

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jason Taylor - 14 Feb 2005 04:31 GMT
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

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.