Passing a Memorystream object to a Web Service

S

Steve

I am using an XMLSerializer to create an xml object of a
class in a web application. I am then using an XMLWriter
to place this into a memory stream. No problems so far.

I have a web service that is to receive a
System.IO.MemoryStream object and then deserialize it to
retrieve the require information.

When I try to make the call to the WebMethod from my web
application the IDE is showing that it is not expecting a
System.IO.MemoryStream object, but is expecting an object
of type <WebService>.<Service>.MemoryStream i.e.
WebApplication.WebService.SystemMemoryStream.

If I just pass my memory stream object I get the compile
error: Cannot Convert from 'System.IO.MemoryStream'
to 'WebApplication.WebService.MemoryStream'.

Any ideas on why this isn't working? Or is there a better
way to do this???

---- Sample code from WebApp (user is my object) ----
XmlSerializer serializer = new XmlSerializer(typeof(User));
XmlWriter memWriter = new XmlTextWriter(ms, Encoding.UTF8);
serializer.Serialize(memWriter, user);
HiBISws.Control webService = new HiBIS.HiBISws.Control();
webService.Login(ms);


---- Sample code from Web Service ----
[WebMethod]
public void testStream(System.IO.MemoryStream ms)
{
//Do nothing yet
Console.WriteLine("test ms");
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top