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 555493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:49:13+00:00 2026-05-13T11:49:13+00:00

I have an XSD, and used the xsd.exe tool to create c# classes. In

  • 0

I have an XSD, and used the xsd.exe tool to create c# classes. In a webservice I am accepting in the MessageContract an instance of one of these created objects.

The relevant portion of the xsd to this question is here:

<xs:element name="Tasks">
    <xs:complexType>
        <xs:sequence>
            <xs:element ref="Task" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
</xs:element>
<xs:element name="Task"> ... </xs:element>

The xsd created this:

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)]
public partial class Tasks {

    /// <remarks/>
    [System.Xml.Serialization.XmlElementAttribute("Task")]
    public Task[] Task;
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)]
public partial class Task { ... }

SOAPUI created a soap request from the WSDL that looks like this:

<Tasks>
  <Task>
    <Task>
      .. task data here
    </Task>
  </Task>
</Tasks>

note the extra wrapper element. When trying to run that soap request, I get a deserialization error: Error in line x position y: ‘Element’ ‘WWW’ from namespace ‘ZZZ’ is not expected. Expecting element ‘SSS’

After finding the extraneous node in the generated SOAP request, I made my new request look as such:

<Tasks>
  <Task>
    ...task data here
  </Task>
</Task>

Now the deserializer ‘works’, but in my method the Tasks object contains an empty Task array.

So my question is: Why is the automated request generator creating the wrapper Task object, and why when I remove it am I getting an empty array in my Tasks object?

  • 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-13T11:49:13+00:00Added an answer on May 13, 2026 at 11:49 am

    You might find your answer if you change the class and property names so they aren’t all Task and Tasks.

    At a glance though:

    <Tasks> <-- the root element for your Tasks class.  public partial class Tasks
      <Task> <-- the Task property of your Tasks class.  public Task[] Task
        <Task> <-- The first serialized task
          .. task data here
        </Task>
        <Task> <-- The second serialized task
          .. second task data here
        </Task
      </Task>
    </Tasks>
    

    Another way to look at it is to compare how you’d access a Task within your Task collection of your Tasks class:

    var myTasks = new Tasks(); // An instance of your Tasks class
    var myTasksTasks = myTasks.Task; // accessing the `Task[]` property of your `Tasks` class
    var myFirstTask = myTasks.Task[0]; // accessing the first Task instance within the Task[] array of your Tasks class
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the past, I have used XSD.exe to create c# classes from an xsd.
I have created an XML schema (foo.xsd) and used xjc to create my binding
I am new to xml's. I have used xsd.exe to create a .xsd file
I have used xsd.exe tool to generate data class but wcf doesn't like the
I have an XSD file which is used to generate some objects which are
I have an XML file that I used to create an XSD File and
I have two files, one with webservice description (wsdl), second with data structures used
I have a XSD I generated using xsd.exe and then created a class off
I have one xsd file ,I used xmlpad to validate this xsd against xml
I used xsd.exe to create a class from xml schema. It generated several partial

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.