WcfRestContrib icon indicating copy to clipboard operation
WcfRestContrib copied to clipboard

POX Reader can't handle base64 binary (HakanL)

Open mikeobrien opened this issue 15 years ago • 7 comments

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.

mikeobrien avatar Aug 11 '10 17:08 mikeobrien

where is the patch?

BabelFish80 avatar Oct 26 '10 03:10 BabelFish80

The patch was attached to the issue in codeplex, I'm trying to figure out how I can attach the patch on github.

HakanL avatar Oct 26 '10 05:10 HakanL

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

HakanL avatar Oct 26 '10 05:10 HakanL

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!

BabelFish80 avatar Oct 26 '10 06:10 BabelFish80

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?

BabelFish80 avatar Oct 26 '10 06:10 BabelFish80

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.

HakanL avatar Oct 26 '10 06:10 HakanL

This is applied to the trunk now, yea!

HakanL avatar Nov 03 '10 03:11 HakanL