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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:03:33+00:00 2026-05-25T03:03:33+00:00

I have a classes defined as below (generated using xsd): [GeneratedCodeAttribute(xsd, 4.0.30319.1)] [SerializableAttribute] [DebuggerStepThroughAttribute]

  • 0

I have a classes defined as below (generated using xsd):

[GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[SerializableAttribute]
[DebuggerStepThroughAttribute]
[DesignerCategoryAttribute("code")]
[XmlTypeAttribute(AnonymousType = true)]
[XmlRootAttribute(IsNullable = false)]
public class DataRequest
{
    private string _serviceField;
    private string _subscriptionField;

    public string Service
    {
        get
        {
            return _serviceField;
        }
        set
        {
            _serviceField = value;
        }
    }

    [XmlElement("Subscription"), DefaultValue(null)]
    public string Subscription
    {
        get
        {
            return _subscriptionField;
        }
        set
        {
            _subscriptionField = value;
        }
    }
}

Then , I define an array of the above class:

DataRequest[] requests = new DataRequest[2];
requests[0] = new DataRequest();
requests[1] = new DataRequest();
...

I want to serialize this array and end up with the below:

  <SOAP-ENV:Body>
    <DataRequest>
      <Service>ServiceA</DataService>
      <Subscription />
    </DataRequest>
    <DataRequest>
      <Service>ServiceB</DataService>
      <Subscription />
    </DataRequest>
  </SOAP-ENV:Body>

However, when I call the below, where input is the array:

XmlSerializer serializer = new XmlSerializer(typeof(input));
serializer.Serialize(writer, input);

I get the following:

  <Soap-ENV:Body>
    <ArrayOfDataRequest>
      <DataRequest>
        <Service>ServiceA</DataService>
        <Subscription />
      </DataRequest>
      <DataRequest>
        <Service>ServiceB</DataService>
        <Subscription />
      </DataRequest>
    </ArrayOfDataRequest>
  </Soap-ENV:Body>

Is there some way I can get rid of the ArrayOfDataRequest element, and just have the actual array elements serialized directly?

  • 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-25T03:03:34+00:00Added an answer on May 25, 2026 at 3:03 am

    Please correct me if i am wrong, but I think this is totally right what concerns SOAP-specific serialization. The immediate child of the body tag is the element for the parameter, in this case an array of DataRequest objects. When the serializer would leave out the ArrayOf… tags, the SOAP message would instead contain two parameters of type DataRequest.

    Maybe you can specify why you would need such a “broken” message to find a solution for you actual problem?

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

Sidebar

Related Questions

I have defined two classes below: public class junk { private BigInteger a =
I have the below classes defined, @Entity @Idclass(Key.class) public void ClassA { ... @Id
I have the following classes defined to do validation: public class DefValidator : IValidate<IDef>
I have always wondered why you cannot use locally defined classes as predicates to
if I have two classes, and have defined an explicit type conversion between them,
I have defined an Event class: Event and all the following classes inherit from
I have seen some C++ classes with a destructor defined as follows: class someClass
My doc strings have references to other python classes that I've defined. Every time
I have an interface defined as below: public interface TestInterface{ int id { get;
In my CSS file, I have defined a class as given below. input.entryFormInputBoxColor:focus {

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.