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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:23:05+00:00 2026-05-26T12:23:05+00:00

I am having a RESTful service with the following method: [WebInvoke] string GetDataFromStringAsString(string xmlString);

  • 0

I am having a RESTful service with the following method:

[WebInvoke] 
string GetDataFromStringAsString(string xmlString); 

My client call to the method is as below:

var client = new RestClient(); 
client.BaseUrl = serviceBaseUrl; 
var request = new RestRequest(method){RequestFormat = DataFormat.Xml}; 
request.Resource = resourceUrl; 
request.AddParameter("text/xml", requestBody, 
ParameterType.RequestBody); 
var response = client.Execute(request); 

Let us take a string to post as “Hello World”.

Now the string that i post to the above method gives me a 400 Bad
request. In order to get it working i had to wrap the above string in
a element as shown below:

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

Now when i post the above string i get a success response back from
the server.

Why is that i have to manually wrap the string to make it work. Is
there a way that i can achieve to post a string without doing the
above manually.

  • 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-26T12:23:06+00:00Added an answer on May 26, 2026 at 12:23 pm

    The only other way that I am aware of is to use stream as your input parameter. e.g.

    [WebInvoke] 
    string GetDataFromStringAsString(stream xmlString);
    

    The problem with .Net 4 WCF REST is that fundamentally WCF only knows how to pass two types of info, either XML or a stream of bytes. Personally, I would use WCF Web API instead of the standard WCF REST library because you are going run into lots more of these kinds of issues.

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

Sidebar

Related Questions

I am having trouble understanding how to call a RESTful service More specifically, I
I am having a heck of a time calling a RESTful service from within
I'm having a mind blowing problem using WCF 4.0 RESTful service. I am trying
I'm having trouble building a restful service with Lift. All I want to do
I'm using the RESTful authentication Rails plugin for an app I'm developing. I'm having
Having read the threads Is SqlCommand.Dispose enough? and Closing and Disposing a WCF Service
Having to upgrade a database schema makes installing a new release of software a
Having a problem getting a TreeView control to display node images. The code below
I'm having a frustrating time with Spring 3 MVC trying to build RESTful web
I'm new to rails and having trouble figuring out how to do this RESTfully.

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.