You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tested and this string is serializable into OrderCreateRequest, so it's valid JSON.
I'm sending this message as Content-Type "application/json".
However, deserialization fails with DeserializationException:
The request body could not be deserialized. Encountered unexpected character '%'.
And this is due to code in
public object Deserialize(WebFormatterDeserializationContext context, Type type)
{
if (context.ContentFormat != WebFormatterDeserializationContext.DeserializationFormat.Xml)
throw new InvalidDataException("Data must be in xml format.");
var serializer = new DataContractJsonSerializer(type);
return serializer.ReadObject(context.XmlReader);
}
This code looks fishy. XmlReader here is {None} in execution. And ReadObject here raises exception in question.
I suspect this is a WcfRestContrib issue or an application config problem, since I don't know what else could be the reason for this. Sending request encoded as application/json to POST in HTTP seems to be valid and my string is validly encoded and can be deserialized into proper JSON. However, somehow I cannot see that WCF/WcfRestContrib is fetching that string properly and there is no more stack trace here so that I can see any more details.
Help or comment would be appreciated.
The text was updated successfully, but these errors were encountered:
From Web.xml
My service returns serialized JSON result without problems, but there is a problem with deserialization from JSON.
It's configured with
and the method is
I'm testing it using a Java client where I'm sending a
I tested and this string is serializable into OrderCreateRequest, so it's valid JSON.
I'm sending this message as Content-Type "application/json".
However, deserialization fails with DeserializationException:
The request body could not be deserialized. Encountered unexpected character '%'.
And this is due to code in
This code looks fishy. XmlReader here is {None} in execution. And ReadObject here raises exception in question.
I suspect this is a WcfRestContrib issue or an application config problem, since I don't know what else could be the reason for this. Sending request encoded as application/json to POST in HTTP seems to be valid and my string is validly encoded and can be deserialized into proper JSON. However, somehow I cannot see that WCF/WcfRestContrib is fetching that string properly and there is no more stack trace here so that I can see any more details.
Help or comment would be appreciated.
The text was updated successfully, but these errors were encountered: