Format exception on submit
-
Thursday, November 24, 2011 2:51 PM
I faced with following strange exception. Data Services throws it on submit, the responce have 400 status code. I use default .Net 4.0 client, should I tweak something on client side or server side?
The server encountered an error processing the request. Please see the service help page for constructing valid requests to the service. The exception message is 'Incoming message for operation 'ProcessRequestForMessage' (contract 'IRequestHandler' with namespace 'http://tempuri.org/') contains an unrecognized http body format value 'Xml'. The expected body format value is 'Raw'. This can be because a WebContentTypeMapper has not been configured on the binding. See the documentation of WebContentTypeMapper for more details.'. See server logs for more details. The exception stack trace is:
at System.ServiceModel.Dispatcher.HttpStreamFormatter.GetStreamFromMessage(Message message, Boolean isRequest) at System.ServiceModel.Dispatcher.HttpStreamFormatter.DeserializeRequest(Message message, Object[] parameters) at System.ServiceModel.Dispatcher.UriTemplateDispatchFormatter.DeserializeRequest(Message message, Object[] parameters) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc& rpc) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
- Moved by Vitek Karas - MSFTMicrosoft Employee Thursday, November 24, 2011 3:02 PM (From:WCF Data Services)
All Replies
-
Friday, November 25, 2011 1:47 AMModeratorHello, do you have a custom service method that accepts a stream, and on the client side, you're sending an xml file? If so, refer to http://blogs.msdn.com/b/carlosfigueira/archive/2008/04/17/wcf-raw-programming-model-receiving-arbitrary-data.aspx for a solution.
Lante, shanaolanxing This posting is provided "AS IS" with no warranties, and confers no rights.
If you have feedback about forum business, please contact msdnmg@microsoft.com. But please do not ask technical questions in the email. -
Friday, November 25, 2011 8:38 AM
No, I have simple Data Service added to my EF model, without service operations nor explicit streams usage.
Only one suspicious data type used for some entity properties is byte array (mapped to SQL Rowversion column).
Upd: but it is not the reason of exception - without byte[] properties service throws the same exception.
- Edited by AlikDev Friday, November 25, 2011 8:55 AM
-
Monday, November 28, 2011 3:06 PM
Ok, I added dummy ContentTypeMapper and now it works in Raw mode without exceptions.- Marked As Answer by AlikDev Monday, November 28, 2011 3:06 PM
-
Monday, August 20, 2012 4:35 PM
I'm having the same issue with my web service. Can you kindly elaborate on what you have done? Is this something you did with IIS configuration? Or, is it something you added to your web service code?
Thank you for your help in advance.
-
Friday, March 29, 2013 8:55 PM
I would also be interessted in the solution details, because I have the same problem with a OData Service
Thank you for the help
-
Thursday, May 23, 2013 6:35 PM
Sorry for late answer, hope it will be helpful for someone who will find this thread later:
Error message states: "Incoming message for operation 'ProcessRequestForMessage' (contract 'IRequestHandler' with namespace 'http://tempuri.org/') contains an unrecognized http body format value 'Xml'. The expected body format value is 'Raw'.
Well, if it cannot map content type, there should be some way to map it manually and MSDN article WebContentTypeMapper Sample shows how you can do it.
Nevertheless, it is still puzzle for me why Raw, not Xml, that time I just mapped and forgot.

