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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:25:31+00:00 2026-06-05T02:25:31+00:00

I have a ServiceStack REST service (PUT and POST) which I have tested with

  • 0

I have a ServiceStack REST service (PUT and POST) which I have tested with fiddler and if no errors are raised I return

new HttpResult(HttpStatusCode.OK); 

Now I am testing the same REST service with the service stack client, I have:

var client = new XmlServiceClient("url"));
client.Post<ChangeServerLicenseDto>("", new ChangeServerLicenseDto()
         {ServerName = model.ServerName});

and I get the exception on the REST service when I do

    return new HttpResult(HttpStatusCode.OK)

and the error raised is :

      500 (Error in line 1 position 76. Expecting element 'ChangeServerLicense'
      from namespace ''.. Encountered 'Element'  with name 'HttpStatusCode',
      namespace 'http://schemas.datacontract.org/2004/07/System.Net'.) 

My client code is in a MVC action method (POST).

My datacontract for the RestService is :

[DataContract(Name = "ChangeServerLicense", Namespace = "")]
[RestService("url", "POST", "application/xml")]
public class ChangeServerLicenseDto
{
    [DataMember(Name = "ServerName", Order = 1)]
    public string ServerName { get; set; }
}
  • 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-06-05T02:25:32+00:00Added an answer on June 5, 2026 at 2:25 am

    The convention of signalling a successful response is to return an empty Response DTO (which by default returns a 200 OK). Also Send<TResponse>(...) does a POST so if you don’t want to include the url in the request, use Send which will POST the request to the automatic pre-defined routes:

    var client = new XmlServiceClient("url"));
    client.Send<ChangeServerLicenseDtoResponse>(
        new ChangeServerLicenseDto {ServerName = model.ServerName});
    

    Otherwise if you still want to use .Post<T>(...) include the URL for the custom route where your services is mounted.

    Note: I generally dislike using Dto suffixes on DTOs which are the most important API in your service – I explain in a bit more detail why here.

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

Sidebar

Related Questions

have created REST service using servicestack and in post request I have return object
I have constructed a simple Rest service using ServiceStack (which is brilliant), that returns
I have some issue regarding REST API which i have built using servicestack. End
I have just started to use ServiceStack which is an amazing library. However, I
I have built a service with ServiceStack (customer example) as per this link: https://docs.google.com/present/view?id=dg3mcfb_213gsvvmmfk
I have a Self-Hosted (Console App) WCF REST service with the following binding: WebMessageEncodingBindingElement
I'm evaluating ServiceStack for use in a Windows Service to host REST services. So
I have a working ServiceStack application which started off part of my MVC application
have not tested on windows. but in ubuntu when u disconnect from the network,
Have converted devise new session from erb to Haml but doens't work, this 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.