{"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>\n

Hence 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>\n

Request Header:<\/strong><\/p>\n

User-Agent: Fiddler
\nHost: localhost:1510
\nContent-Length: 198
\nContent-Type: application\/xml<\/p><\/blockquote>\n

Request 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":"\nWCF - The incoming message has an unexpected message format 'Raw' : Binary Bits<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.binarybits.net\/wcf-the-incoming-message-has-an-unexpected-message-format-raw\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"WCF - The incoming message has an unexpected message format 'Raw' : Binary Bits\" \/>\n<meta property=\"og:description\" content=\"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 […]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.binarybits.net\/wcf-the-incoming-message-has-an-unexpected-message-format-raw\/\" \/>\n<meta property=\"og:site_name\" content=\"Binary Bits\" \/>\n<meta property=\"article:published_time\" content=\"2013-09-07T04:58:47+00:00\" \/>\n<meta name=\"author\" content=\"Kannan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@Kannan_B\" \/>\n<meta name=\"twitter:site\" content=\"@Kannan_B\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kannan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/blog.binarybits.net\/wcf-the-incoming-message-has-an-unexpected-message-format-raw\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/blog.binarybits.net\/wcf-the-incoming-message-has-an-unexpected-message-format-raw\/\"},\"author\":{\"name\":\"Kannan\",\"@id\":\"https:\/\/blog.binarybits.net\/#\/schema\/person\/dda0e26212583a95f286cf67604fd855\"},\"headline\":\"WCF – The incoming message has an unexpected message format ‘Raw’\",\"datePublished\":\"2013-09-07T04:58:47+00:00\",\"dateModified\":\"2013-09-07T04:58:47+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/blog.binarybits.net\/wcf-the-incoming-message-has-an-unexpected-message-format-raw\/\"},\"wordCount\":121,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/blog.binarybits.net\/#\/schema\/person\/dda0e26212583a95f286cf67604fd855\"},\"keywords\":[\"Fiddler\",\"REST\",\"WCF\"],\"articleSection\":[\"WCF\",\"Web\"],\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/blog.binarybits.net\/wcf-the-incoming-message-has-an-unexpected-message-format-raw\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/blog.binarybits.net\/wcf-the-incoming-message-has-an-unexpected-message-format-raw\/\",\"url\":\"https:\/\/blog.binarybits.net\/wcf-the-incoming-message-has-an-unexpected-message-format-raw\/\",\"name\":\"WCF - The incoming message has an unexpected message format 'Raw' : Binary Bits\",\"isPartOf\":{\"@id\":\"https:\/\/blog.binarybits.net\/#website\"},\"datePublished\":\"2013-09-07T04:58:47+00:00\",\"dateModified\":\"2013-09-07T04:58:47+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/blog.binarybits.net\/wcf-the-incoming-message-has-an-unexpected-message-format-raw\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/blog.binarybits.net\/wcf-the-incoming-message-has-an-unexpected-message-format-raw\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/blog.binarybits.net\/wcf-the-incoming-message-has-an-unexpected-message-format-raw\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/blog.binarybits.net\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"WCF – The incoming message has an unexpected message format ‘Raw’\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/blog.binarybits.net\/#website\",\"url\":\"https:\/\/blog.binarybits.net\/\",\"name\":\"Binary Bits\",\"description\":\"Bits & Pieces - A blog by Kannan Balasubramanian\",\"publisher\":{\"@id\":\"https:\/\/blog.binarybits.net\/#\/schema\/person\/dda0e26212583a95f286cf67604fd855\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/blog.binarybits.net\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-GB\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/blog.binarybits.net\/#\/schema\/person\/dda0e26212583a95f286cf67604fd855\",\"name\":\"Kannan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/blog.binarybits.net\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/blog.binarybits.net\/wp-content\/uploads\/2017\/04\/12976869_10207528235497646_1307827709790943986_o.jpg\",\"contentUrl\":\"https:\/\/blog.binarybits.net\/wp-content\/uploads\/2017\/04\/12976869_10207528235497646_1307827709790943986_o.jpg\",\"width\":1270,\"height\":1270,\"caption\":\"Kannan\"},\"logo\":{\"@id\":\"https:\/\/blog.binarybits.net\/#\/schema\/person\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"WCF - The incoming message has an unexpected message format 'Raw' : Binary Bits","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.binarybits.net\/wcf-the-incoming-message-has-an-unexpected-message-format-raw\/","og_locale":"en_GB","og_type":"article","og_title":"WCF - The incoming message has an unexpected message format 'Raw' : Binary Bits","og_description":"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 […]","og_url":"https:\/\/blog.binarybits.net\/wcf-the-incoming-message-has-an-unexpected-message-format-raw\/","og_site_name":"Binary Bits","article_published_time":"2013-09-07T04:58:47+00:00","author":"Kannan","twitter_card":"summary_large_image","twitter_creator":"@Kannan_B","twitter_site":"@Kannan_B","twitter_misc":{"Written by":"Kannan","Estimated reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blog.binarybits.net\/wcf-the-incoming-message-has-an-unexpected-message-format-raw\/#article","isPartOf":{"@id":"https:\/\/blog.binarybits.net\/wcf-the-incoming-message-has-an-unexpected-message-format-raw\/"},"author":{"name":"Kannan","@id":"https:\/\/blog.binarybits.net\/#\/schema\/person\/dda0e26212583a95f286cf67604fd855"},"headline":"WCF – The incoming message has an unexpected message format ‘Raw’","datePublished":"2013-09-07T04:58:47+00:00","dateModified":"2013-09-07T04:58:47+00:00","mainEntityOfPage":{"@id":"https:\/\/blog.binarybits.net\/wcf-the-incoming-message-has-an-unexpected-message-format-raw\/"},"wordCount":121,"commentCount":0,"publisher":{"@id":"https:\/\/blog.binarybits.net\/#\/schema\/person\/dda0e26212583a95f286cf67604fd855"},"keywords":["Fiddler","REST","WCF"],"articleSection":["WCF","Web"],"inLanguage":"en-GB","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/blog.binarybits.net\/wcf-the-incoming-message-has-an-unexpected-message-format-raw\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/blog.binarybits.net\/wcf-the-incoming-message-has-an-unexpected-message-format-raw\/","url":"https:\/\/blog.binarybits.net\/wcf-the-incoming-message-has-an-unexpected-message-format-raw\/","name":"WCF - The incoming message has an unexpected message format 'Raw' : Binary Bits","isPartOf":{"@id":"https:\/\/blog.binarybits.net\/#website"},"datePublished":"2013-09-07T04:58:47+00:00","dateModified":"2013-09-07T04:58:47+00:00","breadcrumb":{"@id":"https:\/\/blog.binarybits.net\/wcf-the-incoming-message-has-an-unexpected-message-format-raw\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.binarybits.net\/wcf-the-incoming-message-has-an-unexpected-message-format-raw\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/blog.binarybits.net\/wcf-the-incoming-message-has-an-unexpected-message-format-raw\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blog.binarybits.net\/"},{"@type":"ListItem","position":2,"name":"WCF – The incoming message has an unexpected message format ‘Raw’"}]},{"@type":"WebSite","@id":"https:\/\/blog.binarybits.net\/#website","url":"https:\/\/blog.binarybits.net\/","name":"Binary Bits","description":"Bits & Pieces - A blog by Kannan Balasubramanian","publisher":{"@id":"https:\/\/blog.binarybits.net\/#\/schema\/person\/dda0e26212583a95f286cf67604fd855"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.binarybits.net\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-GB"},{"@type":["Person","Organization"],"@id":"https:\/\/blog.binarybits.net\/#\/schema\/person\/dda0e26212583a95f286cf67604fd855","name":"Kannan","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/blog.binarybits.net\/#\/schema\/person\/image\/","url":"https:\/\/blog.binarybits.net\/wp-content\/uploads\/2017\/04\/12976869_10207528235497646_1307827709790943986_o.jpg","contentUrl":"https:\/\/blog.binarybits.net\/wp-content\/uploads\/2017\/04\/12976869_10207528235497646_1307827709790943986_o.jpg","width":1270,"height":1270,"caption":"Kannan"},"logo":{"@id":"https:\/\/blog.binarybits.net\/#\/schema\/person\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/blog.binarybits.net\/wp-json\/wp\/v2\/posts\/550"}],"collection":[{"href":"https:\/\/blog.binarybits.net\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.binarybits.net\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.binarybits.net\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.binarybits.net\/wp-json\/wp\/v2\/comments?post=550"}],"version-history":[{"count":6,"href":"https:\/\/blog.binarybits.net\/wp-json\/wp\/v2\/posts\/550\/revisions"}],"predecessor-version":[{"id":556,"href":"https:\/\/blog.binarybits.net\/wp-json\/wp\/v2\/posts\/550\/revisions\/556"}],"wp:attachment":[{"href":"https:\/\/blog.binarybits.net\/wp-json\/wp\/v2\/media?parent=550"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.binarybits.net\/wp-json\/wp\/v2\/categories?post=550"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.binarybits.net\/wp-json\/wp\/v2\/tags?post=550"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}