The question arises: how to use one namespace for the answer when using the IHasResponseStatus and public ResponseStatus ResponseStatus { get; set; } properties public ResponseStatus ResponseStatus { get; set; } public ResponseStatus ResponseStatus { get; set; } public ResponseStatus ResponseStatus { get; set; } and remove the d2p1 prefix on ResponseStatus .
I use one http://schemas.tagway.com.ua/types namespace for all web service models; the answer looks great except for the node ResponseStatus because ServiceStack: it automatically adds its own xmlns:d2p1="http://schemas.servicestack.net/types" 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 the NTPCore.ServiceModel project:
[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")]
Answer example:
<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>
source share