Embedded documents (base64REncoded) in XML

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
Eugene
Posts: 14
Joined: Sat Apr 22, 2017 12:01 am

Embedded documents (base64REncoded) in XML

Post by Eugene »

Hi All,
Has anyone embedded a base64encoded document in an XML message using Composer and Mapforce? I've created a map that accepts a string, the encoded document, and maps it to an XML document provided by the US Government. The Process takes a word document file, zips it up, and then uses the 'base64_encode' activity to encode the contents. I then use the 'for_each_txtlin' to read the encode file, line by line. Each line is then concatenated to form one long text string. This is then passed to the map. However, when I run this process I get the error 'command missing ending closing bracket token. Are there any other methods I could use instead?
Thanks in advance.
Eugene
PatrickF
Posts: 30
Joined: Thu Nov 26, 2015 1:31 pm

Re: Embedded documents (base64REncoded) in XML

Post by PatrickF »

Are you able to dump out the encoded base64 string to a SQL Table or text file and use https://www.base64decode.org/ to validate the Base64 you are generating. Where I have needed to handle BLOBs/CLOBs in XML I have written to a DB and then mapped that back to the target format.
Also take a look at the https://www.altova.com/manual/Mapforce/ ... ncode.html and https://www.altova.com/manual/Mapforce/ ... ecode.html functions, which might be easier than FOR_EACH_TXTLIN
Eugene
Posts: 14
Joined: Sat Apr 22, 2017 12:01 am

Re: Embedded documents (base64REncoded) in XML

Post by Eugene »

Thanks Patrick.
I ended up using mapforce to handle the mapping rather than the 'FOR_EACH_TXTLIN'. It's a much neater solution.
I added a text file input using the base64 encoded file and mapped that to the xml document. I set the text file filename to dynamic and passed the filename into the map from the process.
Post Reply