infor.com
concierge
infor u
developer portal
documentation central
customer center
Posts
Categories
Groups
ERPs
CSD
FSM/HRT
LN
M3
Syteline/ CSI
Hubs
Developer
Healthcare
Hospitality
Public Sector
Onboarding
Release Center
CloudSuites
Aerospace & Defense (LN)
Automotive (LN)
Chemicals (M3)
Corporate (FSM/HRT)
Distribution (Sx.e/CSD)
Distribution Enterprise (M3)
Engineering & Construction (LN)
Fashion (M3)
Food & Beverage (M3)
Healthcare (FSM/HRT)
Industrial (Syteline/CSI)
Industrial Enterprise (LN)
Manufacturing (M3)
Public Sector (FSM/HRT)
Solutions
Supply Chain Management (SCM)
Human Capital Management (HCM)
Events
Groups
User Groups
Your Groups
About
Email Community Support
Infor News
Migrated Forums
Home
Clovertech
Clovertech Archive
Cloverleaf
java proc / base64 string
Stewart
How do you setup/configure/use java on msgs? I need to decode a base64 string to PDF and don't know that this is possible w/ tcl.
Find more posts tagged with
Clovertech
Comments
Tipu Razaq (Clovertech)
With TCL you have to read/write the file as binary
set infile [open "base64string" rb]
set outfile [open "file.pdf" w+b]
puts $outfile [binary decode base64 [read $infile]]
close $infile
close $outfile
david_barr
This is possible with TCL, although to be honest this is one of my biggest struggles with Cloverleaf. Making sure the binary data isn't corrupted as it's put into a message with msgset, routed to another threads, possibly read back into TCL with msgget, sent out via an outbound thread seems difficult. You have to keep track of the message encoding settings on the threads that the data passes through. You have to keep track of (and maybe change) the encoding system that TCL uses (see the "encoding system" command in TCL).
For a project that I was working on recently, I had some binary data passing through Cloverleaf that I tried to reencode into base64, and I was never able to figure out why the encoding wouldn't work. The data would be garbage when it was decoded by the receiver. I ended up coming up with a workaround that didn't require the encoding. My code was using the tcllib base64 module and not the TCL binary command, so maybe that was part of the problem.
I've got some sample code that we run if you want to see how we use it.
Jeff Dinsmore
I've used the base64 package in Tcl.
package require base64
base64::encode <your data to encode here>
set decodedString [base64::decode <your base64 data here>]
if you're reading a PDF file to be encoded in a message, open the PDF file with binary translation.
set pdfPath /tmp/jeffTestPdf.pdf
set infile [open $pdfPath r]
fconfigure $infile -translation binary
set encodedPdfString [base64::encode [read $infile]]
close $infile
Stewart
I was able to create the file and based on the file contents it looks to have decoded the string. However, the PDF is blank. Thoughts?
Jim Kosloskey
I would first make sure the supplied data is indeed encoded properly. One way I would do that is to locate a utility product that decodes base64 file and see if that produces a viewable PDF.
Here is a link but a search on the Internet should produce a number of free utilities.
https://sourceforge.net/directory/os:windows/?q=base64+decryption+utility
Stewart
I found the solution. I had to use fconfigure.
set codedString "<base64 string>"
set outfile [open <filename>.pdf w+]
fconfigure $outfile -encoding binary -translation binary
puts $outfile [base64::decode $codedString]
close $outfile