{"id":550,"date":"2013-09-07T10:28:47","date_gmt":"2013-09-07T04:58:47","guid":{"rendered":"https:\/\/blog.binarybits.net\/?p=550"},"modified":"2013-09-07T10:28:47","modified_gmt":"2013-09-07T04:58:47","slug":"wcf-the-incoming-message-has-an-unexpected-message-format-raw","status":"publish","type":"post","link":"https:\/\/blog.binarybits.net\/wcf-the-incoming-message-has-an-unexpected-message-format-raw\/","title":{"rendered":"WCF – The incoming message has an unexpected message format ‘Raw’"},"content":{"rendered":"
I was testing out my own WCF REST Service using Fiddler and was getting error response “The incoming message has an unexpected message format ‘Raw'”.<\/p>\n
After spending time diagnosing the message the clue was, the WCF was getting a request with no content type.<\/p>\n
My contract was specifically expecting the request format to be XML using the following attribute<\/p>\n
RequestFormat = WebMessageFormat.Xml<\/pre>\nHence added the content type as “application\/xml” and things went fine.<\/p>\n
The following is an example of Fiddler’s request for a REST POST with composite data type<\/p>\n
Type:<\/strong> POST
\nURL:<\/strong> http:\/\/localhost:1510\/GalleryService.svc\/RestService\/GetDataUsingDataContract\/
\nProtocol:<\/strong> HTTP\/1.1<\/p>\nRequest Header:<\/strong><\/p>\n
User-Agent: Fiddler
\nHost: localhost:1510
\nContent-Length: 198
\nContent-Type: application\/xml<\/p><\/blockquote>\nRequest Body:<\/strong><\/p>\n
<CompositeType xmlns=\"http:\/\/schemas.datacontract.org\/2004\/07\/Net.BinaryBits.Apps.BBGallery.WebService\"><BoolValue>true<\/BoolValue><StringValue>String content<\/StringValue><\/CompositeType><\/pre>\n","protected":false},"excerpt":{"rendered":"I was testing out my own WCF REST Service using Fiddler and was getting error response “The incoming message has an unexpected message format ‘Raw’”. After spending time diagnosing the message the clue was, the WCF was getting a request with no content type. My contract was specifically expecting the request format to be XML […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[148,9],"tags":[152,150,210],"yoast_head":"\n
WCF - The incoming message has an unexpected message format 'Raw' : Binary Bits<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n