0

I have this HTTP POST service:

POST /test/test.asmx/getValues HTTP/1.1
Host: localhost
Content-Type: application/x-www-form-urlencoded
Content-Length: length

xmlstr=string

I want have this service:

POST /test/test.asmx/getValues HTTP/1.1
Host: localhost
Content-Type: application/xml
Content-Length: length

xmlstr=string

How can i change Server's Content-Type value to application/xml? I'm using IIS and VB .NET.

Thanks.

ptorsson
  • 488
  • 7
  • 10
Eipoc
  • 1
  • 1

1 Answers1

0

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.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335