How to Serialization the class from a webservice request

Tech-Archive recommends: Speed Up your PC by fixing your registry



Hi,

I'm using .net 1.1 and have a web reference to a 3rd party.

What I'm attempting to do is when I get a "failed" response from the
webservice (that's inserting some data or doing something else) I want
to serialise the response object to disk.

So for instance in reference.vb I have the lines


<System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://....
yada yada yada", RequestNamespace:=".... yada yada yada",
ResponseNamespace:=".... yada yada yada",
Use:=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)>
_

Public Function TestDatabaseExists() As Result
Dim results() As Object = Me.Invoke("TestDatabaseExists",
New Object(-1) {})
Return CType(results(0), Result)
End Function

<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://....
yada yada yada")> _
Public Class Result

'<remarks/>
Public ResultType As ResultType

'<remarks/>
Public Message As String

'<remarks/>

<System.Xml.Serialization.XmlArrayItemAttribute(IsNullable:=False)> _
Public Errors() As [Error]
End Class


So If I call the TestDatabaseExisits function I get an object back of
type Result. So what I want to do is write the serialized Result
object to disk. Attempting to do so throws the error;

The type WSIntegration.Result in Assembly WSIntegration,
Version=3.1.3134.15657, Culture=neutral, PublicKeyToken=null is not
marked as serializable.

So I change the line

<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://....
yada yada yada")> _
Public Class Result

to

<Serializable()")> _
Public Class Result

and it does work!!!! ... but I don't wan't to start altering the
reference.vb and for some reason it doesn't work for all the classes
defined in the reference.vb



Can anyone suggest an alternative way of letting me do this or give me
some advise?

Thanks.
Steve.
.



Relevant Pages

  • Re: Hunting wild boar? An apology
    ... # while I am a relative noob here(but not to Usenet) I'm not exactly sure ... # why my response to Jeff K.got posted 3 times. ... # must approve yada, yada, yada. ...
    (rec.guns)
  • Re: Hunting wild boar? An apology
    ... # # while I am a relative noob here(but not to Usenet) I'm not exactly sure ... # # why my response to Jeff K.got posted 3 times. ... # # must approve yada, yada, yada. ...
    (rec.guns)
  • Re: A new, CORRECT evolutionary theory
    ... > Your initial response is as primitive as they come. ... > out a single error. ... And the link to shameless commerce is a nice added touch. ... Yada, yada, yada. ...
    (sci.anthropology.paleo)
  • Re: Hunting wild boar? An apology
    ... why my response to Jeff K.got posted 3 times. ... I assure you I only hit ... must approve yada, yada, yada. ...
    (rec.guns)