I'm working on a project where I need to compress XML, convert to Base64 and send it to a SOAP web server.
I couldn't find a better way to do this, without having to export the XML to some temp directory, execute a external lib to compress the file and then import the compressed file so I could convert it to Base64 and send it.
I was wondering if there was a better solution for this.
Brian got there first. But if you have access to the .NET classes then this is a good way to go. I set up compression of all the blobs in a database and it didn't take long to sort out at all.
Thanks for replying.
Current OE version is 10.2b, although we've already started working with 11.6.
OS is windows server.
We're not using .net classes, but I'll take a look either way.
there is a "standard library" on eo hive with some zlib content...
NB. haven't used it myself.
If you use the WRITE-XML() Method you can use a MEMPTR as target-type. To encode just use the base64-encode function passing the memptr. You will get a longchar with base64 encoded text Is this what you are looking for?
> On Jan 26, 2016, at 8:11 AM, Brian K. Maher wrote:
> For 10.2B, you should google for zlib,
zlib is part of OpenEdge. You should have it in the DLC/bin or lib directory.
"If I set here and stare at nothing long enough, people might think I'm an engineer working on something."
-- S.R. McElroy
> On Jan 26, 2016, at 9:24 AM, Peter Judge wrote:
> While true, there are some caveats, not least of which is that it doesn't ship with all products (only with the dev products, IIRC).
it was put in for the 4GL client / appserver stream compression
it is actually very simple to use but i do not have any 4gl examples. but there are on oehive
Is it possible to use .net class DeflateStream in 10.2b?
I'm trying to create an example but I'm unable to define the enumerator CompressionLevel, which is the second parameter of the DeflateStream Constructor.
I'm not used to work with .net within ABL.
On 11.6 it seems to work, but on 10.2b it doesn't compile due to the following error:
Could not locate element 'CopyTo' in class 'System.IO.FileStream'. (12927)
Anyway, I wonder if I could use a MemoryStream instead of a FileStream in order to work just with just memptrs.
I was able to convert a memptr into a MemoryStream, though I'm not sure if it works as I couldn't convert it back to memptr.
def var mXML as memptr no-undo.
def var mResult as memptr no-undo.
def var streamSize as int no-undo.
def var memStream as MemoryStream no-undo.
def var i as int no-undo.
/* load memptr var with some value */
/* memptr to MemoryStream */
streamSize = get-size(mXML).
memStream = new MemoryStream(streamSize).
do i = 1 to streamSize:
/* MemoryStream to memptr*/
set-size(mResult) = memStream:Length.
do i = 1 to memStream:Length:
put-byte(mResult, i) = memStream:ReadByte().
Answering my own question.
CopyTo doesn't work on 10.2b because it is available just for .NET version 4.0 and above.
According to progress, 10.2.b only supports .NET 3.0.
There are some compression examples included in the download of my PugChallenge presentation on .Net.
I 'm not sure if they will work on 10.2B.
Look in PugUtils.cls