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

  • SEARCH
  • Home
  • 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 8322553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:25:48+00:00 2026-06-08T23:25:48+00:00

I am going to try my best to keep this post short and concise.

  • 0

I am going to try my best to keep this post short and concise. I apologize in advance if I need to make a number of edits to add code.

The problem

I have a class I am able to serialize into XML correctly. The class sends the XML to a web service that returns a XML response. The XML response is then deserialized into objects for additional processing. I am able to properly deserialize my objects, providing that the returned XML is not a sequence

What I have tried

I have created my class to look like:

[other class declarations here to support XML response]

public class OrderInfoListResponse
{
    public List<OrderInfo> OrderInfo { get; set; }

    public OrderInfoListResponse()
    {
        OrderInfo = new List<OrderInfo>();
    }
}

The deserializer looks like:

using (Stream respStream = response.GetResponseStream())
{
    XmlSerializer serializer = new XmlSerializer(typeof(OrderListResponse));
    orderResp = serializer.Deserialize(respStream) as OrderListResponse;
}

If I pass in data that looks like:

 <ResponseBody>
    <PageInfo>
       <TotalCount>51</TotalCount>
       <TotalPageCount>6</TotalPageCount>
       <PageSize>10</PageSize>
       <PageIndex>1</PageIndex>
 </PageInfo>
 <RequestID>4546ASDDAS54</RequestID>
 <OrderInfoList>
        <OrderInfo>
            <SellerID>XXXX</SellerID>
            <OrderNumber>111111111</OrderNumber>
            <InvoiceNumber>222222</InvoiceNumber>
            ....
        </OrderInfo>
 <OrderInfoList> 

I am able to get the PageInfo data and RequestID with no isses, but my resulting object shows

OrderInfoList
    OrderInfo count = 0

If I display the response as a string I get 51 responses.

The question

Why am I not able to deserialize into OrderInfo?

What I’ve tried

I tried the following code, but my count is still 0:

using (Stream respStream = response.GetResponseStream())
{
    StreamReader readerOK = new StreamReader(respStream);
    string resp = @readerOK.ReadToEnd();
    var myEncoder = new ASCIIEncoding();
    var bytes = myEncoder.GetBytes(resp);
    var memoryStream = new MemoryStream(bytes);
    var xmlSerializer = new XmlSerializer(typeof(OrderListResponse));
    orderResp = xmlSerializer.Deserialize(memoryStream) as OrderListResponse;
 }

Setting a breakpoint on myEncoder shows that string resp contains a full XML response, setting a breakpoint after orderResp shows all fields are set, except for the list objects.

I have instantiated my orderResp object via setting it to null at the start of the method. I have also instantiated every instance of an object contained within that class, both with no results.

If I remove all collections (lists, arrays etc ) from the classes, I am able to deserialize the first response in the XML file, subsequent responses are not deserialized and are skipped.

Any other ideas? Anyone?

  • 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-06-08T23:25:51+00:00Added an answer on June 8, 2026 at 11:25 pm

    The issue was how the class was created.

    The original class looked like:

    public class OrderListResponseBody
    {

        public PageInfo PageInfo { get; set; }  
        public string RequestID { get; set; }  
        public string RequestDate { get; set; } 
        public List<OrderInfoListResponse> OrderInfoList { get; set; }  
    }
    

    The new class looks like:

    public class OrderListResponseBody
    {
    
        public PageInfo PageInfo { get; set; }  
        public string RequestID { get; set; }  
        public string RequestDate { get; set; } 
        public List<OrderInfo> OrderInfoList { get; set; }  <!-- notice the change
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry in advance im going to try and explain this as best as possible....
I'm going to try to explain this best I can I will provide more
Ok, I'm going to try to make this more clear because my last question
OK, I'm going to try my best to explain my problem. I have this
I will try and keep this short and to the point. Given the following
I'm going to try and explain this the best I can. I used this
I'm going to try and explain this the best I can... I have one
I'm going to try this new cloud technology. So I think the best place
This is going to be hard to explain but I'll try my best. I
Alright, I'm going to try to explain this as best as possible: I have

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.