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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:07:27+00:00 2026-06-15T02:07:27+00:00

The question is: how to use one namespace for response, when using IHasResponseStatus and

  • 0

The question is: how to use one namespace for response, when using IHasResponseStatus and public ResponseStatus ResponseStatus { get; set; } property, and remove the prefix d2p1 on ResponseStatus.

I use a single namespace http://schemas.tagway.com.ua/types for all web service models; the response looks great except the node ResponseStatus, because ServiceStack: it automatically adds its own namespace xmlns:d2p1="http://schemas.servicestack.net/types" for ResponseStatus.

Service model:

namespace NTPCore.ServiceModel.Operations.Balance
{
    public class Balance
    {
        public Auth auth { get; set; }    
    }

    public class BalanceResponse : IHasResponseStatus
    {
        public ResponseStatus ResponseStatus { get; set; }
        public int balance { get; set; }
        public int limit { get; set; }
    }
}

AssemblyInfo.cs in project NTPCore.ServiceModel:

[assembly: ContractNamespace("http://schemas.tagway.com.ua/types",    ClrNamespace = "NTPCore.ServiceModel.Operations.Balance")]
[assembly: ContractNamespace("http://schemas.tagway.com.ua/types",    ClrNamespace = "ServiceStack.ServiceInterface.ServiceModel")]             //may be this not need...experimenting, nothing happance for me

Example response:

<BalanceResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.tagway.com.ua/types">
  <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
    <d2p1:ErrorCode>String</d2p1:ErrorCode>
    <d2p1:Errors>
      <d2p1:ResponseError>
        <d2p1:ErrorCode>String</d2p1:ErrorCode>
        <d2p1:FieldName>String</d2p1:FieldName>
        <d2p1:Message>String</d2p1:Message>
      </d2p1:ResponseError>
    </d2p1:Errors>
    <d2p1:Message>String</d2p1:Message>
    <d2p1:StackTrace>String</d2p1:StackTrace>
  </ResponseStatus>
  <balance>0</balance>
  <limit>0</limit>
</BalanceResponse>
  • 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-15T02:07:28+00:00Added an answer on June 15, 2026 at 2:07 am

    ServiceStack makes use of .NET’s built-in XML DataContractSerializer for its XML Serialization. Unfortunately for the [assembly: ContractNamespace ..] to have an effect you need to decorate your DTOs with [DataContract] and [DataMember] attributes. e.g:

    [DataContract]
    public class Balance
    {
        [DataMember]
        public Auth auth { get; set; }    
    }
    
    [DataContract]
    public class BalanceResponse : IHasResponseStatus
    {
        [DataMember]
        public ResponseStatus ResponseStatus { get; set; }
    
        [DataMember]
        public int balance { get; set; }
    
        [DataMember]
        public int limit { get; set; }
    }
    

    It’s ugly, but that’s the price to pay for pretty XML, the other option is to override the built-in XML Content-Type with your own custom Serialization/Deserialization routines – but that requires more work.

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

Sidebar

Related Questions

QUESTION: What is the proper way to use .get() in conjunction with .one() (or
Simple question. I'm new to Clojure. How can I use one file from my
my question is similar to this one , but I don't want to use
My question is, which one is better to use? How to properly use a
Is it more performant to use a Prepared Statement with one question mark in
I have a question regarding use of FFT. Using function getBand(int i) with Minim
Recently I've started converting my framework to use the php namespaces and one question
First, a more abstract question. Is it good practice to use a namespace instead
Other questions dealing with use of match_parent pre 2.2 have answers stating one should
Question I use celery to launch task sets that look like this: I perform

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.