none
The request failed with HTTP status 415: Unsupported Media Type

    Question

  • I have a WCF service and when I try and use it from the client application I get this error. It's not helpful. What is a "media type"? I looked up "media" in my web.config file but it didn't appear.

     

    Please answer this in English without a lot of jargon. Thanks!

    Monday, October 06, 2008 6:07 PM

Answers

  • In order to successfully connect your service to the third party client, you'll need to know:

     

    (1) What kind of messaging system is the client designed for?  Does it use Soap (1.1 or 1.2), or it it using plain old XML (pox), JSON, or something else?

     

    (2) What kind of message exchange pattern is used - is the client expecting a single response for every request, does it send requests without expecting responses, or might there be multiple responses per request?

     

    (3) What do request messages look like and what should the responses look like? In a SOAP-based service, this is described by the operation contract..

     

    (4) Is there any message security or other special binding requirements for the communication

    Tuesday, October 07, 2008 10:06 PM
    Moderator

All replies

  • How is the client sending the requst to the WCF service? This error means that the client is sending something that the server is not expecting. For example, if the service is expecting a XML request (in HTTP terms, content-type: application/xml), and the client sends a text (text/plain), JSON (application/json) or any other request type, then you'll see this error.
    Tuesday, October 07, 2008 3:58 AM
  • OK I guess my question is how can I set up my service to receive this:

     

    Content Type text/xml; charset=utf-8 was sent to a service

     

    I got that information from the Microsoft Service Trace Viewer. I thought WCF was all about avoiding coupling with client applications - seems that I have to set up the service specifically here! The client app is 3rd party so I can't change it - my service has to concede to what it sends.

     

    Tuesday, October 07, 2008 2:04 PM
  • In order to successfully connect your service to the third party client, you'll need to know:

     

    (1) What kind of messaging system is the client designed for?  Does it use Soap (1.1 or 1.2), or it it using plain old XML (pox), JSON, or something else?

     

    (2) What kind of message exchange pattern is used - is the client expecting a single response for every request, does it send requests without expecting responses, or might there be multiple responses per request?

     

    (3) What do request messages look like and what should the responses look like? In a SOAP-based service, this is described by the operation contract..

     

    (4) Is there any message security or other special binding requirements for the communication

    Tuesday, October 07, 2008 10:06 PM
    Moderator