POX Reader can't handle base64 binary (HakanL)
The POXXmlReader is passing some requests down to the XmlReader/XmlDictionaryReader and intercept others with its XmlNodeReader through the property Reader. I ran into an issue where the POX reader couldn't deal with base64 binary data, even if its Reader could. The framework calls ReadObject and when the stream contains base64 data it throws a NotSupported exception. But if I check the XmlNodeReader that the POX is using for most of the methods, then it works. But ReadContentAsBase64 is not intercepted and is then passed down to XmlDictionaryReader, which cannot handle base64 binary.
I've attached a patch that implements a base64 handler for the POX reader.
where is the patch?
The patch was attached to the issue in codeplex, I'm trying to figure out how I can attach the patch on github.
I'm not sure if I did this right, but I created a fork where I applied my patch: http://github.com/HakanL/WcfRestContrib/commit/608d0c1f804e5bfd8159feae6645ed1bc8391bc7
ahh CanReadBinaryContent, that is what i forgot. yeah, I need to figure how to checkout/checkin changes so I can upload my additions as well.thanks!
that fix didnt seem to resolve my issue. I am still getting the error "The request body could not be deserialized. 'EndElement' 'FileContents' from namespace '' is not expected. Expecting element '__identity'." I have a datacontract that contains a memorystream datamember. the parser cant seem to parse the data. the normal DataContract parser works fine though. any thoughts?
I don't think pox will handle memorystream directly, I think you need to use byte[] in your contract. You should get down to the bare minimums in your contract.
This is applied to the trunk now, yea!