S
Shone
My problem is that I want my class instance to be serialized
differently for different purposes. Suppose I want to exchange the
object between different components on the local network by
serializing it into XML, and therefore I defined the class with
included XML attributes:
<XmlRoot(ElementName:="results")> _
Public Class clsOneClass
<XmlElement("first")> _
Public value1 As Integer
<XmlElement("second")> _
Public value2 As Integer
<XmlIgnore)> _
Public Status As Boolean
End Class
So, this is working fine, and just like I want when I use
"xmlser.Serialize(output,obj)", where xmlser is defined as :
Dim xmlser As New XmlSerializer(...type of obj...)
But now I need to exchange this object via web services, actually this
type will be the return of a web method, and for this purpose (and
this only!) I want the public member "Status" to be passed along,
which means it needs to be serialized within the SOAP message.
But of course, web service "reads" the XML attributes of a class and
doesn't include "Status" into serialized SOAP msg.
How can I define and choose the alternative XML/SOAP serialization ?
More details:
On the client side, I let VS to automatically create the whole wrapper
for the web service it consumes (just added the web reference). I
don't implement any custom SOAP formatting, however I tried to
mess-around a little bit with the reference.vb. Namely, I tried to add
the Public member "Status" to the autogenerated skeleton class, but of
course that didn't solve the problem - because when web service
serializes it's response into SOAP, it doesn't include the "Status" of
the original "clsOneClass" object, so the same member on the client
side remains empty (actually default boolean = False).
I hope this was clear enough to the ws experts that know what I'm
talking about here.
Thank you very much!
Shone
differently for different purposes. Suppose I want to exchange the
object between different components on the local network by
serializing it into XML, and therefore I defined the class with
included XML attributes:
<XmlRoot(ElementName:="results")> _
Public Class clsOneClass
<XmlElement("first")> _
Public value1 As Integer
<XmlElement("second")> _
Public value2 As Integer
<XmlIgnore)> _
Public Status As Boolean
End Class
So, this is working fine, and just like I want when I use
"xmlser.Serialize(output,obj)", where xmlser is defined as :
Dim xmlser As New XmlSerializer(...type of obj...)
But now I need to exchange this object via web services, actually this
type will be the return of a web method, and for this purpose (and
this only!) I want the public member "Status" to be passed along,
which means it needs to be serialized within the SOAP message.
But of course, web service "reads" the XML attributes of a class and
doesn't include "Status" into serialized SOAP msg.
How can I define and choose the alternative XML/SOAP serialization ?
More details:
On the client side, I let VS to automatically create the whole wrapper
for the web service it consumes (just added the web reference). I
don't implement any custom SOAP formatting, however I tried to
mess-around a little bit with the reference.vb. Namely, I tried to add
the Public member "Status" to the autogenerated skeleton class, but of
course that didn't solve the problem - because when web service
serializes it's response into SOAP, it doesn't include the "Status" of
the original "clsOneClass" object, so the same member on the client
side remains empty (actually default boolean = False).
I hope this was clear enough to the ws experts that know what I'm
talking about here.
Thank you very much!
Shone