If you are ensuring that you will return only XML by removing JSON formatter like this
config.Formatters.Remove(config.Formatters.JsonFormatter);
you can use a message handler to add the envelope blindly for all responses like this.
public class MyHandler : DelegatingHandler
{
protected override async Task<HttpResponseMessage> SendAsync(
HttpRequestMessage request,
CancellationToken cancellationToken)
{
var response = await base.SendAsync(request, cancellationToken);
string responseBody = "<rsp stat=\"ok\">" +
await response.Content.ReadAsStringAsync() +
"</rsp>";
response.Content = new StringContent(
responseBody, Encoding.UTF8, "application/xml");
return response;
}
}