Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > soap message

Thread Tools

soap message

Tony Johansson
Posts: n/a

Below I have a simple console program that is using the SoapFormatter to
serialize an object ShoppingCartItem into file.

Assume that we serialize this object by using SoapFormatter and sent it away
so it can be deserialized in another application on another computer. I mean
when we deserialize we do this
item = (ShoppingCartItem)sf.Deserialize(fs);
knowing that the object is a ShoppingCartItem that is going to be

Now to my question when writing code on the receiving application that will
deserialize the object
how is it possible to write code that know in advance what type of object
that we have so a suitable cast can be done as we do here
item = (ShoppingCartItem)sf.Deserialize(fs);
Can somebody explain this ?

public static void Main(string[] args)
ShoppingCartItem item = new ShoppingCartItem(4370, 423.50M, 1);
FileStream fs = new FileStream("Test.sop", FileMode.Create);
SoapFormatter sf = new SoapFormatter();
sf.Serialize(fs, item);

fs = new FileStream("tonyTest.bin", FileMode.Open);
item = (ShoppingCartItem)sf.Deserialize(fs);


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to add SOAP header to a SOAP message? Peter van der veen ASP .Net Web Services 6 11-14-2006 06:44 PM
how to use servlet to receive message (not soap message) John Java 8 03-28-2005 01:39 PM
writing a SOAP message service, how do I get the attachment from a message? rabbits77 Java 0 02-26-2004 08:52 PM
To SOAP or Not To SOAP? mooseshoes XML 3 09-21-2003 04:38 PM
SOAP Client creation in ASP.NET using MS SOAP Toolkit Sham Ramakrishnan ASP .Net 2 07-01-2003 11:29 AM