BASE64-DECODE with Base64 Encoded Data from WebSpeed.

plafferty

New Member
Hi Guys

This is my first post on here so bare with me. I've got the guidelines at hand and will try my best.
I'm using btoa on my Angular frontend on a stringifyed JsonObject and I'm sending the encoded data through WebSpeed to a process on my backend.
Please see below some sample code to represent the process that is failing:

Capture.PNG

As this is a .w being called by WebSpeed my error messages go out to the webspeed.server.log file and they are:
Capture2.PNG


Its a bit temperamental and occasionally works as expected. At the moment the pattern appears to be that it works on the first attempt after refreshing my app. Another thing to consider is that are there certain characters that cannot be converted from Base64? E.g. number or special characters.

What I've tried:
I've looked a various progress articles and a Progress Talk thread on the same issue. None of the suggestions have helped hence a new thread.
Sorry - had to take a snippet of it because I kept getting a ProgressTalk error saying my message was spam-like.
Capture3.PNG

Device/Product info
Progress Version Number: 11.7
Service Pack: Not sure
Product Name: Progress Dev Studio OE
OS and version: Windows 10 Pro 2019

Thanks for reading and any help, advice or suggestion would be much appreciated.
 

Stefan

Well-Known Member
Catch your errors and dump the contents of invalid inputs to a file so that you have something tangible to work with.

You seem to be jumping through quite a few hoops.
You can post json directly to WebSpeed - see OpenEdge 11.7 Documentation

Everything can be converted to base64 - that's the whole point of base64, it's also used for binary data.

To check your service pack, just:
Code:
message proversion(1)
 

plafferty

New Member
Thanks for your suggestions Stefan. I am aware I can post Json straight to WebSpeed. At the moment I am using the get-value function and I'm posting my data using query params. The problem is that the data is somewhat sensitive and I am therefore keen to encrypt it somehow. My data needs to be encrypted in javascript/typescript then decrypted on my progress backend. I am aware the base64 can easily decoded but as soon as I get this part working I plan to add a randomly generated string to the base64 to make it harder to decode.

Without sounding too rude or demanding are you able to provide some sample code that would either suppress my errors or suggest an alternative for sending encoded data to Webspeed with the hope of decoding it in Progress.

Once again, thanks in advance for your help. As someone that has only been working with Progress for 2 years I am very grateful to be part of a forum like this with so many Progress 4GL professionals.
 
Last edited:

Stefan

Well-Known Member
Something like below:

Code:
do on error undo, throw:

   lcRawData = get-value("fi_data").
   mDecoded = base64-decode( lcRawData ).

   catch e as progress.lang.error:

      def var cfile as char no-undo.

      cfile = session:temp-directory + guid + ".b64".
      copy-lob from lcRawData to file cfile.
      message e:getMessage(1) cfile.

   end catch.

end.
 
Last edited:

plafferty

New Member
Thank you very much. I will try this out and reply. Its just coming up midnight over here so I'll give it go tomorrow night
 

plafferty

New Member
Thanks everyone for your suggestions.
Unfortunately not got round to trying this out yet, but when I do, I will let you know.
 
Top