Summary of 415 Unsupported Media Type errors and fun consuming .NET web services within Service Now
- How to fix 415 error?
- What is a 415 error?
- What does the 415 code mean?
- What is the reason code 415?
Search Results
AI Overview
AI Overview
A
415 Error is an HTTP status code that means “Unsupported Media Type”. The server refuses to accept the request because the format of the data (the “payload”) being sent is in a format not supported by the server for the given operation.
Common Causes
The error typically results from a mismatch between what the client sends and what the server is configured to accept. Common causes include:
Incorrect Content-Type header: The most frequent cause is when the Content-Type header in the request does not match the actual data format being sent. For example, sending JSON data but specifying text/plain as the content type.
Unsupported media type: The server’s configuration does not support the specific media type (MIME type) indicated in the request header. For instance, an API might only accept application/json but the client sends application/xml.
Incorrect Content-Encoding header: The data is compressed or encoded in a way the server does not understand or is not configured to decode (e.g., using gzip without the server having the necessary module enabled).
Typos or non-standard naming: Simple errors like using charset=UTF8 instead of the standard charset=UTF-8 can cause the server to reject the request.
How to Fix a 415 Error
Fixing the error involves ensuring the client and server agree on the data format and encoding.
Verify the Content-Type header: Double-check that the Content-Type header in your request is present and correctly specifies the format of the data you are sending (e.g., application/json for JSON data).
Check the server’s accepted types: Consult the API documentation or use tools like browser developer tools (in the Network tab) to see what media types the server actually expects or is willing to process. The Accept header in the server’s response can provide hints on the expected input format.
Ensure correct encoding: If you are using compression, ensure the Content-Encoding header is correct and that the server is configured to handle that specific encoding format.
Correct client-side configuration: If using a client-side tool or library (like Postman or a specific programming library), make sure it is configured to send the correct headers and data format. For example, in Postman, ensure you select “JSON” from the dropdown menu for the body type instead of the default “Text”.
Update server configuration: If you control the server, you may need to update its configuration files (e.g., in Apache or Nginx) to support the required media type or encoding.
415 Unsupported Media Type – KeyCDN Support
May 5, 2023 — 415 Unsupported Media Type. … As a website owner or developer, you know how frustrating it can be when your website doesn’t func…
KeyCDN
Resolving the HTTP 415 Error on Your Website – 10Web
Mar 1, 2024 — Resolving the HTTP 415 Error on Your Website * What is the HTTP 415 error? * Variations of this error. * Reasons why this error oc…
10Web
What Is a 415 Status Code? Causes, Fixes, and Best Practices
Jul 7, 2025 — Key Takeaways * The 415 status code indicates that the server can’t handle the format due to a wrong or missing header. * Always v…
IPRoyal.com
Show more
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
I am going to go out on a limb here and say 99 percent of all the people on this forum will not read this blog. I am going to protect my pride by admitting that this error is very specific, and for the most part a lot of us will probably never see it. LUCKY ME – I saw it. I am going to try and put this as simple as I can (that sentence is my way of getting you ready for a long-winded answer to a more complex issue). At the end of this blog if anyone has any questions, please feel free to comment or email. I would be happy to save you a few hours of troubleshooting time.
I have only encountered the 415 error while trying to consume a .NET web service using WCF via a MID-Server. I am sure it can come up while consuming other web service types as well.
This problem occurs because within the SOAP Request Header there is a key called “Content-Type” and the value pair we are sending differs from that specified on the web server. I know what you are thinking. ISN’T that suppose to be specified in the WSDL contract then?
The short answer to that question is, yes and yes it is.
If you were to import the same WSDL into SOAPUI you would see that it recognizes the WHTTPSBinding in the WSDL and uses the Content-Type: application/soap+xml.
but…
If you were to consume the same web service, using the same WSDL you just imported into SOAPUI, within SNC (going through a MID-Server I haven’t tried it without the MID-Server yet) you will notice that we use the Content-Type: text/xml.
When the receiving web service gets this request it checks to make sure Content-Type are the same. If they are not, well you get the 415 error. I know it sucks and if you are dealing with this I hope you have access to your web server and can change the code, or you can hack the SOAP Request Header on your instance. Either solution isn’t pretty.
As IBM stated on one of their blogs, “When a SOAP client sends a SOAP message to a SOAP server it uses HTTP protocol for transportation. This is called SOAP Binding with HTTP.”
Luckily enough for me the customer I was working with was also the web programmer and wrote the server code offering this service.
Wheew! Now for what you have been waiting for. HOW did we fix it?
Well in the web.config for the server the binding for the endpoint was set to this: wsHttpBinding and it needed to be changed to basicHttpBinding.
What a mess I know. The moral of the story is stick with basicHttpBinding when you are writing your own web service that you want to consume from SNC through a MID-Server. Maybe this is an issue we can start fixing on our end as well. Of course the ideal functionality would be to recognize the binding type in the WSDL provided and change the Request Header to the correct Content-Type. Cheers and happy coding.
- 4,770 Views
You must be a registered user to add a comment. If you’ve already registered, sign in. Otherwise, register and sign in.