Results 1 to 5 of 5

Thread: Uncompress GZipStream

  1. #1
    Join Date
    Feb 2009
    Location
    Maasland, The Netherlands
    Posts
    2,605

    Default Uncompress GZipStream

    I am testing with a webservice, that returns a value with GZipStream compression. When I copy the value from the debugger into a online service I can decompress it to XML.

    I have tried several things with Chilkat (version 9.5.0.55 from 2016) without success. The function ComUncompressString returns nothing.

    Has anyone done this before? Am I using the wrong function?

    Code:
    Get wsGetTFSTransactionsV2 of oWSIAudit stRequest to stResponse
    
    // Response: 
    // stResponse.Compression   "GZipStream"
    // stResponse.Value         "H4sIAAAAAAAEAJ   " 
    
    Get Create (RefClass(cComChilkatGlobal)) to hoGlobal
    If (Not(IsComObjectCreated(hoGlobal))) Begin
       Send CreateComObject of hoGlobal
    End
    Get ComUnlockBundle of hoGlobal CHILKAT_UNLOCK_CODE to iSuccess
    If (iSuccess <> True) Begin
       Get ComLastErrorText Of hoGlobal to sTemp1
       Showln sTemp1
       Procedure_Return
    End
    
    
    Get ComVersion of hoGlobal to sTemp1  // 9.5.0.55
       
    Get Create (RefClass(cComChilkatGzip)) to hoGzip
    If (Not(IsComObjectCreated(hoGzip))) Begin
        Send CreateComObject of hoGzip
    End
    
    Get ComUncompressString of hoGzip stResponse.Value "utf-8" to sXML
    Best regards,

    Peter van Mil
    Appvantage b.v.

  2. #2
    Join Date
    Feb 2009
    Location
    Zeist, Netherlands
    Posts
    184

    Default Re: Uncompress GZipStream

    Hi Peter,

    I think you have to use ComUnCompressStringEnc, because the compressed string is probably base64 encoded.

    Regards, IJmert.
    I you create laws that are only interpretable by computers you get ruled by a computer...!

  3. #3
    Join Date
    Feb 2009
    Location
    Maasland, The Netherlands
    Posts
    2,605

    Default Re: Uncompress GZipStream

    Hi IJmert,

    Thank you very much. With the function below the XML string is returned!

    Code:
    Get ComUncompressStringENC of hoGzip stResponse.Value "utf-8" "base64" to sXML
    Best regards,

    Peter van Mil
    Appvantage b.v.

  4. #4
    Join Date
    Feb 2009
    Posts
    5,467

    Default Re: Uncompress GZipStream

    Just a side note on this if you get a GZip'ed file from a service you need to create an blank folder and call ComUnTarGz into that folder and then go through the folder contents

    The format is much less flexible than Zip as you can't 'see' the files in it etc
    Success consists of going from failure to failure without loss of enthusiasm - Winston Churchill

  5. #5
    Join Date
    Feb 2009
    Location
    Maasland, The Netherlands
    Posts
    2,605

    Default Re: Uncompress GZipStream

    I will look into it. At the moment I just can decompress the stream into a XML string without creating a folder. I will have to see if it is reliable or not. (I am not interested in files, only in the XML data).
    Best regards,

    Peter van Mil
    Appvantage b.v.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •