Base64 encoding is character set dependent. If you encode your data
with an encoder for some EBCDIC CCSID and your online encoder expects
it to be UTF8 it won't work.
The ILEastic project has a Base64 encoder for UTF8. This will
definitely work better with the online encoders. I have successfully
used it for JWT signing where you also have to Base64 encode the parts
of the JWT token.
On 16.05.19 23:36, Greg Wilburn wrote:
Is this the easiest way to Base64 encode and XML document (either in
an RPG variable or on the IFS) for use in a SOAP web service?
I've used Scott's BASE64R4 service program for smaller things like
API keys, etc.
I've been trying to mock-up a test scenario, and I'm not getting the
results I expected - pretty sure I'm doing something wrong with the
varchar fields. The code I'm copying was using much smaller fixed
xmlData and xmlData64 are both varchar(2048)... however the data is
nowhere near that large (utflen=710).
http_setCCSIDs( 1208: 0 );
utflen = HTTP_xlatedyn( %len(%trim(xmlData))
: p_xmlDataUTF );
b64len = base64_encode( p_xmlDataUTF
: %size(xmlData64) );
My resulting data in xmlData64 does not match the online encoders.