xmlwcfrestcontent-typewebhttpbinding

Can I call a WCF service without setting content-type?


I'm trying to replace a legacy REST/plain old xml web service with a WCF one using webHttpBinding. It MUST be backwards compatible with existing clients - which currently do not send a content-type header in the requests.

When I point my clients at my new web service I get HTTP ERROR 415 - missing content type.

Is it possible to configure WCF so it will accept raw requests without a content-type header?


Solution

  • Under .net 3.5 the answer is NO. It seems that content-type is incorectly validated at the transport layer, instead of the application layer. The only way to get around this is to use a custom binding with a custom HtppTransportChannel.

    This bug is fixed in .net 4.0