× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Couple of things wrong that jump out.

But in both your calls not just the Base64.

Normally you should not need to %Trim a varchar - the content should have been trimmed when the field was loaded. so %Len(XMLData) should be fine. But it won't cause a problem. But %Addr(XMLData) it should be %Addr(XMLData : *Data ) to get the address of the data portion.

Similarly you should be using the *Data option for the %Addr( xmlData64 ) as well.

The %Size may or may not be right - I don't have the prototype for base64_encode handy. But %Size of a varchar will include the two byte length for the count (i.e. %Size for a 2,048 Varchar would be 2,050) and that is unlikely to be what you want.


Jon Paris

www.partner400.com
www.SystemiDeveloper.com

On May 16, 2019, at 5:36 PM, Greg Wilburn <gwilburn@xxxxxxxxxxxxxxxxxxxxxxx> 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 length fields.

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))
: %addr(xmlData)
: TO_ASCII
: p_xmlDataUTF );

b64len = base64_encode( p_xmlDataUTF
: utflen
: %addr(xmlData64)
: %size(xmlData64) );

dealloc p_xmlDataUTF;


My resulting data in xmlData64 does not match the online encoders.

Thanks,
Greg
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.