× 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.



Hi Greg,

The code looks okay to me (but, of course, I don't know what the document looks like or what the expected output is meant to be.)

If you look at 'encoded' immediately before running base64_decode, does it look like valid base64 text?

You say that 'decoded' is "blank".  What do you mean by that?  it contains EBCDIC blanks (i.e. x'40404040 ....')?  Or do you mean the length is 0?  What are you expecting it to look like?

It seems unlikely that 'decoded' will be EBCDIC text (unless you know that it should be?).  Base64 will treat it as binary data, so the output will have exactly the same binary values as the data that was input to create the XML document in the first place.   In my experience, that's almost never EBCDIC text.  It may be binary data, like an image, or it may be Unicode data (or perhaps less likely, ASCII data).  But, again, I'm not familiar with the application.   My point is that displaying it in a debugger is not likely to be very satisfying...

-SK

On 7/20/2020 10:13 AM, Greg Wilburn wrote:
I'm using http_post_xml() and a callback procedure to parse the response:

After running this through debug, the resulting length LEN is 33243, but the value of variable DECODED is blanks.

I'm assuming the response data is UTF8 as indicated in the HTTP Debug header.
The encoded data length of the <base64LabelImage> element ( in http debug text file) is 44325

rc = http_post_xml(
'https://elstestserver2.endicia.com/LabelService/EwsLabelService.asmx'
: %addr(SOAP) + 2
: %len(SOAP)
: *null
: %paddr(EndOfElement)
: %addr(userData)
: HTTP_TIMEOUT
: *omit
: 'text/xml; charset=UTF-8; +
SOAPaction="www.envmgr.com/LabelService/GetPostageLabel"'
);



P EndOfElement B
D EndOfElement PI
D userData * value
D depth 10I 0 value
D name 1024A varying const
D path 24576A varying const
D value 65535A varying const
D attrs * dim(32767)
D const options(*varsize)

dcl-s encoded varchar(65535);
dcl-s decoded char(65535);
dcl-s outSize uns(10);
dcl-s len uns(10);

select;
when name = 'Status';
response.status = value;
when name = 'TrackingNumber';
response.trackNbr = value;
when name = 'Base64LabelImage';
encoded = value;

outSize = %len(decoded);
len = base64_decode( %addr(encoded:*data)
: %len(%trim(encoded))
: %addr(decoded)
: outSize
);
response.label = %subst(decoded:1:len);

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Monday, July 20, 2020 10:53 AM
To: rpg400-l@xxxxxxxxxxxxxxxxxx
Subject: Re: Base64 decode

More information, please?


On 7/20/2020 8:52 AM, Greg Wilburn wrote:
It's been a while since I've had to decode something... I'm consuming a web service that is returning a Base64 encoded value... the web service is SOAP XML and returns a corresponding XML response encoding=UTF-8.

I've tried using Scott Klement's Base64 service program... I'm not getting an error, but the resulting value is blank?

Do I need to do something with the data before decoding?

TIA
Greg

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.