Handling of multipart form data containing binary stream in apigee

Not applicable

Hello,

I'm uploading a wav file to my API proxy using multipart form data. My purpose is to process this wav input, convert it to base64 encoded output, and send it out. There is no need to store this wav file.

Following is the hex dump of first line of original wav file:

hexdump 008456C27BBD53EB699239D358CC6CEC_318.wav | more

0000 52 49 46 46 9845 00 00 57 41 56 45 66 6d 74 20 RIFF.E.. WAVEfmt

When I print request.content in my api proxy, this is printed as follows:

52 49 46 46 fffd 45 0 0 57 41 56 45 66 6d 74 20

Binary dump of the same line in apigee:

1010010 1001001 1000110 1000110 1111111111111101 1000101 0 0 1010111 1000001 1010110 1000101 1100110 1101101 1110100 100000

It looks like either the data itself is wrong in request.content or apigee reader is not able to process binary data. I noticed that any hex values greater than 0x80 gets printed as 0xfffd regardless of what is the contained value.

Due to this issue, the base64 encoded output is also wrong.

Can anybody provide me some suggestions on how to process binary data such as wav file in api proxy?

0 2 895
2 REPLIES 2

looks like a content-encoding issue - i think apigee treats it as characters [0x80=127, ASCII printable chars] - can you check your headers?

Encoding was okay. It was audio/x-wav. Meanwhile, since apigee's JS didn't supported binary data, I moved to node.js proxy inside apigee proxy.