1
0
-1

Hallo to everybody, 

We are calling a Rest Api and the reposnce is with content encoding gzip. We cannot decode the http responce.. any ideas ? 

    CommentAdd your comment...

    2 answers

    1.  
      1
      0
      -1

      Thanks for your reply Daniel.

      Do you have to sugest any third party dll to handle the gzip. All the other thinks than you mentioned you have already handle as per your suggestions.

      1. Daniel Iseli

        You are welcome.

        You could simply use Gzip for Windows and spawn the command line tool gzip.exe using the OS Command signature. E.g.

        activate "OSCMD".COMMANDOUT("C:\tools\gzip\bin\gzip -c -d response.txt", Content)

        There are certainly other options to do this. I did not really look for a DLL that implements the uncompress of Gzip.

        I hope this helps.

        Daniel

      2. Thomas Balkis

        Thanks Daniel. Case Closed

      CommentAdd your comment...
    2.  
      1
      0
      -1

      Hello Thomas,

      How do you call the Rest Api? Are you using the UHTTP component?

      In case you are using the UHTTP component then you need to keep in mind that the content parameter of the SEND operation can only handle string data. When the content is gzip compressed then you should use the DUMP_FILE_CONTENTS operation.

      Something like this should work:

      vUhttp->DUMP_FILE_CONTENTS("response.txt", "")
      vUhttp->SEND(vUrl, "POST", "", "", vHeaders, "", vResp)
      vUhttp->DUMP_FILE_CONTENTS("", "")
      

      You then need to uncompress the response with an external tool that supports gzip. There currently is no functionality built into Uniface that can do this (AFAIK).

      In the above sample I assume that we are dealing with a simple download (everything is downloaded in one go). If the server returns the response using chunked file transfer then you have set some additional options for DUMP_FILE_CONTENTS (see the doc).

      I hope this helps.

      Kind regards,

      Daniel

        CommentAdd your comment...