S Anil Kumar Dora S Anil Kumar Dora - 3 months ago 17
reST (reStructuredText) Question

Best way to send an xml string(POST verb) in REST call

I have written a service which accepts an XML as parameter. The API is exposed as a POST verb.

My XML size can grow in future. So I am worried and I don't want to maximize the input message size in web.config.

I tried with Base64 encoding but as the XML contains UNICODE character in CDATA, it creates problem.

Is there any other way so that I can reduce the size of XML to some specific bytes and that much I can configure in my configuration file.


This may be a perfect example of premature optimisation, or YAGNI, or both.

The POST limit is 2MB.

Even if your request is going to be bigger than this, compressing the request is not the answer. What happens when the compressed string gets too big?

If you're worried about this then design your system so that this never happens.