Changing Content Type of XmlServiceClient

How can I change the content type on XmlServiceClient.

For example

    var xmlClient = new XmlServiceClient(url);

    Console.WriteLine(xmlClient.ContentType);

I need to change from “application/xml” to "text/xml.

Thanks

Jay

It’s embedded in the XmlServiceClient so you’d need to override it:

class XmlTextServiceClient : XmlServiceClient
{
    public override string ContentType => "text/xml";
}

But since you’re likely talking to a 3rd Party API you may want to consider using the XML APIs in HTTP Util extension methods which can be used as a general purpose HTTP client that isn’t as opinionated towards ServiceStack.