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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:03:01+00:00 2026-05-24T21:03:01+00:00

I created a RESTful WCF web service and the returned content whether XML, JSON,

  • 0

I created a RESTful WCF web service and the returned content whether XML, JSON, plain text etc. is automatically being wrapped inside a root XML element:

<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">.....content.....</string>

Is this standard behavior? Also is there a setting that can turn this off?

  • 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-24T21:03:04+00:00Added an answer on May 24, 2026 at 9:03 pm

    If you’re returning a string in XML format, you can’t simply return the string “as is”, otherwise you may not have valid XML, so yes, that’s the standard behavior (the default response is how the DataContractSerializer would serialize the result).

    If you don’t want wrapped data, you can move to the raw mode, by returning a Stream (more details at http://blogs.msdn.com/b/carlosfigueira/archive/2008/04/17/wcf-raw-programming-model-web.aspx). If you still want to return a CLR type, but you want to control the serialization format, you can either create a data contract to use, or create a type decorated with the XML serialization attributes (XmlElementAttribute, XmlTextAttribute, XmlAttributeAttribute, etc) and mark the operation (or the contract itself) with the XmlSerializerFormatAttribute.

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

Sidebar

Related Questions

I have a RESTful WCF service that can return XML, JSON, or JSONP, depending
I created a RESTful service using WCF which calculates some value and then returns
I created a simple RESTful WCF service with a single method for receiving files
I'm trying to use WCF 4 to set up a RESTful web service. I'd
I have a RESTful WCF web service called "Palladium" as a project in my
My wcf restful service manages to serve only 2 requests/sec! detailed: I've created a
I am a newbie at WCF. I created a WCF restful service in VS2010
I recently posted a question about a WCF Restful web service that I am
I have a WCF web service that implements a RESTful interface. We're using the
SO I post this json to this restful web service and the post is

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.