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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T22:33:59+00:00 2026-05-12T22:33:59+00:00

I have an object which I serialize nicely into this: <?xml version=1.0 encoding=utf-8 ?>

  • 0

I have an object which I serialize nicely into this:

<?xml version="1.0" encoding="utf-8" ?> 
<people xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" userID="AX12345">
  <group groupID="1234_ABCD">
    <person name="Name 0" id="0" /> 
    <person name="Name 1" id="1" /> 
    <person name="Name 2" id="2" /> 
    <person name="Name 3" id="3" /> 
  </group>
</people>

Which is returned as a string to this:

    [OperationContract]
    [WebGet(UriTemplate = "format/{format}/userid/{userid}/sessionkey/{sessionkey}")]
    string Get(string format,string userid,string sessionkey);

When I view the returned data this service, I get this.

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header />
  <s:Body>
    <GetResponse xmlns="http://tempuri.org/">
      <GetResult>**&lt;?xml version="1.0" encoding="utf-8"?&gt;&lt;people xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" userID="123BOBBY"&gt;&lt;group groupID="1234_ABCD"&gt;&lt;person name="Name 0" id="0" /&gt;&lt;person name="Name 1" id="1" /&gt;&lt;person name="Name 2" id="2" /&gt;&lt;person name="Name 3" id="3" /&gt;&lt;/group&gt;&lt;/people&gt;</**GetResult>
    </GetResponse>
  </s:Body>
</s:Envelope>

And what I would like is this:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header />
  <s:Body>
    <GetResponse xmlns="http://tempuri.org/">
      <GetResult>
        <people userID="AX12345">
          <group groupID="1234_ABCD">
            <person name="Name 0" id="0" /> 
            <person name="Name 1" id="1" /> 
            <person name="Name 2" id="2" />
            <person name="Name 3" id="3" /> 
          </group>
        </people>
      </GetResult>
    </GetResponse>
  </s:Body>
</s:Envelope>

I am a beginner with all this.

  • 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-12T22:34:00+00:00Added an answer on May 12, 2026 at 10:34 pm

    It turns out the answer was fairly simple.

    [XmlSerializerFormat]
    [OperationContract]
    [WebGet(UriTemplate = "format/{format}/userid/{userid}/sessionkey/{sessionkey}")]
    string Get(string format,string userid,string sessionkey);
    

    DataContractSerializer is the default serializer, and [XmlSerializerFormat] overrides the serialization.

    In my classes I have added serialization attributes:

    using System;
    using System.Collections.Generic;
    using System.Xml.Serialization;
    
    namespace Myapp
    {
        [XmlRoot("people")]
        public class People
        {
            private string strUserID = "";
            private List<Group> lstGroup;
    
            public People()
            {
               lstGroup = new List<Group>(); 
            }
    
            [XmlAttribute("userID")]
            public string UserID
            {
                get { return strUserID; }
                set { strUserID = value; }
            }
            [XmlElement("group")]
            public List<Group> Group
            {
                get { return lstGroup; }
                set { lstGroup = value; }
            }
    
         }
    }
    

    While I am happy with the short term gain, I will be looking deeper into this to make sure I keep control of the output.

    Thanks

    P

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

Sidebar

Ask A Question

Stats

  • Questions 216k
  • Answers 216k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If you just want to get it working, you can… May 12, 2026 at 11:13 pm
  • Editorial Team
    Editorial Team added an answer This is not a Java specific issue. You can create… May 12, 2026 at 11:13 pm
  • Editorial Team
    Editorial Team added an answer Install the Eclipse Web Tools Platform. And even without WTP… May 12, 2026 at 11:13 pm

Related Questions

I need a disk backed Map structure to use in a Java app. It
I have found some info on the subject ( like this link) , but
Wondering if anyone can help me with this annoying but trivial (in terms of
I have an object that I'd like to serialize and distribute between processes as
I have object A which in turn has a property of type Object B

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.