Posted: Tue Apr 14, 2009 11:01 am Post subject: Decoding/Encoding base64 with MIME Parser
Newbie
Joined: 14 Apr 2009 Posts: 2
I'm taking in a multi-part message and using the MIME parsing Message Domain on the MQInput node. The part of the message containing the base64 encoded data (a pdf file) is getting decoded on parsing to a hexbinary string. I'm trying to use the XMLNSC base64 support options to re-encode it but it appears almost like it is encoding it a second time. However when I try to let it pass through as a BLOB it stays in hexbinary. Are there parameters or options I am missing?
Here are a few examples of code i have used to encode:
Example1:
DECLARE myBLOB BLOB;
SET myBLOB = InputRoot.MIME.Parts.Part[2].Data.BLOB.BLOB;
CREATE LASTCHILD OF document.doc:DocumentData
TYPE BITOR(XMLNSC.Field, XMLNSC.base64Binary)
NAMESPACE doc
NAME 'Data'
VALUE myBLOB;
Example 2:
DECLARE myBLOB BLOB;
SET myBLOB = CAST(InputRoot.MIME.Parts.Part[2].Data.BLOB.BLOB AS BLOB);
DECLARE base64FieldType INTEGER XMLNSC.Field + XMLNSC.base64Binary;
CREATE LASTCHILD OF OutputRoot DOMAIN 'XMLNSC' NAME 'Data';
CREATE LASTCHILD OF OutputRoot.XMLNSC TYPE base64FieldType NAME 'myBinaryData' VALUE myBLOB;
This has been solved. Turns out that the input node was not truly decoding it to hexbinary. It just needed to be casted to a CHARACTER and then SET to my XML element. So I truly was encoding it a second time.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum