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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:21:49+00:00 2026-05-27T18:21:49+00:00

I have a wcf service and I have class like below: public class Message

  • 0

I have a wcf service and I have class like below:

public class Message
{
    [XmlElement(ElementName = "message")]
    [DataMember(Name = "message")]
    public string message { get; set; }

    [XmlElement(ElementName = "MsgID")]
    [DataMember(Name = "MsgID")]
    public string MsgID{ get; set; }
}

Then i browsed my service in a browser the XML i am getting like below:

<MessageResponse>
    <Status>SUCCESS</Status>
    <Messages>
       <a:Message>
         <a:message>msg1</a:message>
         <a:MsgID>1</a:MsgID>
       </a:Message>
    </Messages>
</MessageResponse>

My Service Contract is Like below: and one more important thing is:
MessageDco class is a copy of Message Class

[ServiceContract(Namespace="")] 
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]    
    public class UserLoginProfileService
    {        
        [WebGet(UriTemplate = "/GetMessages?MsgID={MsgID}")]
        public MessageResponse GetMessage(Guid MsgID)
        {
            MessageResponse objMessageResponse = new MessageResponse();
            try
            {

                Message[] objMessage = new MessageFacade().GetMessage(MsgIDs);
                if (objUserLoginProfile != null)
                {
                    MessageResponse.Status = Status.Success;                   
                    MessageResponse.Messages =Mapper.ToDataContractObjects(objMessage);
                }
                else
                {
                    objMessageResponse.Status = Status.Success;                    
                }
            }
            catch (Exception ex)
            {

                objMessageResponse.Status = Status.Failure;               

            }
            return objMessageResponse;
        }
    }

public class MessageResponse
    {
        [XmlElement(ElementName = "Messages")]
          [DataMember(Name = "Messages")]
        public MessageDco[] Messages { get; set; }

          [XmlElement(ElementName = "Status")]
          [DataMember(Name = "Status")]
          public string Status { get; set; }
}

My mapper class is like below:

public sealed class Mapper
    {
     public static MessageDco[] ToDataContractObjects(IEnumerable<MessageDco> objMessageDco)
    {
        if (objMessageDco != null)
        {
            return objMessageDco.Select(a => ToDataContractObjects(a)).ToArray();
        }
        else
        {
            return null;
        }
    }
}

if we see “a:” is added to the tags. why it is added? i am unable remove that “a:” from the tags. Please help me how to remove “a:” from Tags. And also if you see MessageResponse class (Status tag) is coming correct But array list(i.e: Message[]) in MessageResponse is Coming wrong.

Thanks in advance.

  • 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-27T18:21:50+00:00Added an answer on May 27, 2026 at 6:21 pm

    The a is a generated namespace for your elements.

    For the DataContractSerializer you can remove the namespace for your types in your service definition using the ServiceContractAttribute like so:

    [ServiceContract(Namespace="")] 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given that I have the following WCF service: class LookUpService { public List<County> GetCounties(string
I need help with wcf service. i have a ajax-enabled wcf service: public class
My WCF Service in C# looks like this. [ServiceContract] public class MySecretService { [OperationContract]
I have a wcf service. The service itself (class that inherits the ServiceContract )
I have a property in WCF service class with a initial value, as shown
I have a WCF Service Library (implemented using NH) with one of the class
I have a WCF Web Service which is referenced from a class library. After
I have to get the maximum throughput performance in my WCF service. In one
I have a WCF Service class PersonService which can save Person and his/her Address
I have a class like this: [Serializable] public class Structure { #region Constants and

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.