Click here to Skip to main content
15,867,957 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi there, 


i have a service .svc hosted on a machine whit windows server 2019 on IIS 10,

im tryng to send a POST request whit postman sending a json whit the following headers:

Postman-Token:  calculated when request is sent>

Content-Lenght: calculated when request is sent

Host:           calculated when request is sent

Accept:         * / *

Content-Type:   application/json


and this in the body:

{

  "orderNumber": "12345",
    "idTransaction":"1",
"authorization":"auth",
    "amount":"14.95",
    "paymentDate":"2020-01-01",
    "currency":"euro",
"resultCode": "ok"

}

the service responds correctly and read the json but the status is "406 Not Accettable" ,

as you can see i have placed the Accept header whit value "* / *" that mean accept every kind of content-type in the response,


and that is the response that i get:


response headers:

Content-Type:   application/json; charset=utf-8

Server:         Microsoft-IIS/10.0

X-Powered-By:   ASP.NET

Date:           Mon, 04 Jan 2021 09:54:27 GMT

Content-Length: 69

response body

"Not found any payment whit numeroOrdine=12345."

the server/service read the json and respond correctly couse the number of order 12345 was an example and dosent exist,

but whit status code 406 not accetable,

i tryed also to add the header Accept-Charset: UTF-8 in the request but the situation dosent change,


i checked on iis on the server and after select on the mime type list i can that application/json is in the list, 

maybe i have to enable it somewhere else? Specify the mime type in the web.config file?


or it could be something else?




thanks in advance

What I have tried:

the POST request starts from an application,

i tryed whit postman whit the same results,

i tryed to add Accept-charset: utf-8,

i checked on iis on the server and after select on the mime type list i can that application/json is in the list,
Posted
Updated 4-Jan-21 4:33am
Comments
Dave Kreskowiak 4-Jan-21 10:32am    
It's "with", not "whit".

1 solution

Quote:
The HyperText Transfer Protocol (HTTP) 406 Not Acceptable client error response code indicates that the server cannot produce a response matching the list of acceptable values defined in the request's proactive content negotiation headers, and that the server is unwilling to supply a default representation.

Quote:
response body
"Not found any payment whit numeroOrdine=12345."


I think it's trying to tell you that there is no order with an order number of 12345.

What do you think you should do with that information?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900