The Content-Type
request header describes the format of the data in the body of the request.
xmlstr=string
is encoded using the application/x-www-form-urlencoded
format.
If you said Content-Type: application/xml
then I'd expect the body for me formatted as XML (e.g. <xmlstr>string</xmlstr>
).
The Content-Type you send to the server has no standardised influence over what type of data the server responds with.
The Accept
header can request specific content types:
POST /test/test.asmx/getValues HTTP/1.1
Host: localhost
Accept: application/xml
Content-Type: application/x-www-form-urlencoded
Content-Length: length
xmlstr=string
… but the server side code has to pay attention to it and respect it.
Servers might also allow specific formats to be requested with non-standard request headers, data stored in the query string of the URL, or data in the body.
It will always depend on what the server side code supports.