Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Serializing Object Model

Thread Tools

Serializing Object Model

Dave T
Posts: n/a
I have a generic.list(of T) class that has a property of another class type
that I want to return form a web service. Everything gets populated OK but
when I serialize, the property is left out. Any ideas?

Below, the property in question is "UserInputAddress". In the web service,
just before the serialization, I am able to address the property and it's
components have values.

Namespace DataStructure
<System.Xml.Serialization.XmlRoot("Addresses")> _
<Serializable()> _
Public Class Addresses
Inherits System.Collections.Generic.List(Of Address)


Private _UserInputAddress As New SearchInput
Public Property UserInputAddress() As SearchInput
Return _UserInputAddress
End Get
Set(ByVal value As SearchInput)
_UserInputAddress = value
End Set
End Property


End Class
End Namespace

Namespace DataStructure
<Serializable()> _
Public Class Address

.... A bunch of properties...

End Class
End Namespace

<WebMethod()> _
Public Function SearchByCountyStreet(ByVal County As String, ByVal
Street As String) As System.Xml.XmlDocument
Dim _XML As New System.Xml.XmlDocument
Dim _Addresses As New DataStructure.Addresses
Dim _Serializer As New
System.Xml.Serialization.XmlSerializer(GetType(Dat aStructure.Addresses))
Dim _Writer As New System.IO.StringWriter
_Addresses.UserInputAddress.Jurisdiction = County
_Addresses.UserInputAddress.StreetName = Street
_Serializer.Serialize(_Writer, _Addresses)
Return _XML
End Function

XML(I want to see a "UserInputAddress" element)

<?xml version="1.0" encoding="utf-8"?>
<Addresses xmlnssi=""
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
Serializing Object Model Dave T ASP .Net 0 03-27-2008 04:44 PM
Serializing Object Model Dave T ASP .Net 1 03-24-2008 04:45 PM
Serializing Object Model Dave T ASP .Net Web Services 1 03-24-2008 04:45 PM
Serializing an object from HttpApplicationState Natan ASP .Net 5 09-27-2004 10:53 AM
de/serializing a graphics object learningjava Java 2 01-30-2004 10:40 PM