How to Serialization the class from a webservice request
- From: samh <steven@xxxxxxxxxxxxxxx>
- Date: Thu, 31 Jul 2008 05:41:28 -0700 (PDT)
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.
.
- Prev by Date: Specify credentials for webservice call
- Previous by thread: Specify credentials for webservice call
- Index(es):
Relevant Pages
|