Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6358931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:27:07+00:00 2026-05-24T23:27:07+00:00

I’m a novice at serialization and I’ve run into a problem. I have a

  • 0

I’m a novice at serialization and I’ve run into a problem. I have a REST service that returns an array of IDDescriptionPair objects. When consuming the service, I’m using the “Paste XML as Types” VS add-in to create an object. I’m only modifying this object to add the DataContract attribute so my namespaces match on each end. Here’s that object:

Imports System.Runtime.Serialization

<DataContract([Name]:="IDDescriptionPair", [Namespace]:="http://schemas.datacontract.org/2004/07/Blizzard.ClassLibrary")>
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.225"), _
 System.Diagnostics.DebuggerStepThroughAttribute(), _
 System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://schemas.datacontract.org/2004/07/Blizzard.ClassLibrary"), _
 System.Xml.Serialization.XmlRootAttribute   ([Namespace]:="http://schemas.datacontract.org/2004/07/Blizzard.ClassLibrary", IsNullable:=True)> _
Partial Public Class IDDescriptionPair

  Private descriptionField As String

  Private idField As Integer

  Private idFieldSpecified As Boolean

  '''<remarks/>
  <System.Xml.Serialization.XmlElementAttribute(IsNullable:=True)> _
  Public Property Description() As String
    Get
      Return Me.descriptionField
    End Get
    Set(value As String)
      Me.descriptionField = value
    End Set
  End Property

  '''<remarks/>
  Public Property ID() As Integer
    Get
      Return Me.idField
    End Get
    Set(value As Integer)
      Me.idField = value
    End Set
  End Property

  '''<remarks/>
  <System.Xml.Serialization.XmlIgnoreAttribute()> _
  Public Property IDSpecified() As Boolean
    Get
      Return Me.idFieldSpecified
    End Get
    Set(value As Boolean)
      Me.idFieldSpecified = value
    End Set
  End Property
End Class

I can call the service and deserialize the object, and it appears to work fine. I get a list of the correct number of IDDescriptionPair objects. The problem is that they’re all blank – none of the properties are populated.

Here’s the code where I consume the service:

Dim client As New HttpClient()
Dim endpoint As New Uri("http://bmpscnt410a/services/v1/personservices/offices/5/principals")

Using response As HttpResponseMessage = client.Get(endpoint)
  response.EnsureStatusIsSuccessful()

  Dim idp As List(Of IDDescriptionPair)
  Try
    idp = response.Content.ReadAsDataContract(Of List(Of IDDescriptionPair))()
  Catch ex As Exception
  End Try
End Using

I’ve tried using DataContractSerializer directly, but I get the same result (which is expected, I guess). Any ideas would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T23:27:07+00:00Added an answer on May 24, 2026 at 11:27 pm

    The type which you use is a XmlSerializer type (annotated with attributes from the System.Xml.Serialization namespace, such as <XmlType()>, <XmlRoot()> and so on). For that you’ll need to use the XmlSerializer to deserialize that. If you include (Import) the namespace System.Xml.Serialization, you should get the extension methods ReadAsXmlSerializable, which is what you should be using to deserialize the response.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I am trying to loop through a bunch of documents I have to put
I have some data like this: 1 2 3 4 5 9 2 6

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.