1. Yiannis Papadomichelakis
  2. PowerBuilder
  3. Wednesday, 3 June 2020 14:37 PM UTC

Hi all

I have a small IIS service that has several GET methods and some (in progress) PUT/POST methods.

All my requests have Accept-Encoding: gzip on the header, as pb documentation recommends. This works great on GET methods, however, when I use PUT/POST methods, the response body is not readable.

My WCF POST method has the following attributes:

ResponseFormat = WebMessageFormat.Json

BodyStyle = WebMessageBodyStyle.Bare

 

When I use HttpClient against IIS/8.5, the response is unreadable. The response headers are the following:

HTTP/1.1 200 OK
Cache-Control: private
Date: Wed, 03 Jun 2020 13:50:55 GMT
Content-Length: 124
Content-Type: application/json; charset=utf-8
Content-Encoding: gzip
Server: Microsoft-IIS/8.5
Vary: Accept-Encoding
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET

When I use my local IIS express, the response is readble. The response headers are the following:

HTTP/1.1 200 OK
Cache-Control: private
Date: Wed, 03 Jun 2020 13:58:48 GMT
Content-Length: 2
Content-Type: application/json; charset=utf-8
Server: Microsoft-IIS/10.0
X-AspNet-Version: 4.0.30319
X-SourceFiles: =?UTF-8?B?QzpcVXNlcnNcbWljaGVsb3Ncc291cmNlXHJlcG9zXEVycFdlYlNydlxMb2dpc21vc0VycFdTXEVycFNydi5zdmNcZW1wXERpc2NvdW50c1xQYXJhbVdpblxDYXRhbG9n?=
X-Powered-By: ASP.NET

If I disable gzip compression, both requests return readable results.

Should I consider this a PB bug or it's expected behavior?

Do you recommend any workaround, except disabling gzip compression?

thanks!

  

 

 

Accepted Answer
Mark Lee @Appeon Accepted Answer Pending Moderation
  1. Thursday, 4 June 2020 07:50 AM UTC
  2. PowerBuilder
  3. # Permalink

Hi Yiannis,

Currently the GZIP compression doesn't support for HTTPClient object.  And we will enhance this in the future.

For your issue, you can use the  ExtractorObject object to extract data from the package using the HTTPClient object.

You can refer to the following link in Chapter "Example 1" for help:

https://docs.appeon.com/appeon_online_help/pb2019r2/application_techniques/ch18s03.html#d0e13956

The HTTPClient object sends a request with a header "Accept-Encoding: gzip" which informs the RESTFul Web service that the client can extract data; then the Web service returns a compressed package and a response header "Content-Encoding: gzip" which indicates that the data is compressed, and then the ExtractorObject object extracts data from the package.

Regards,

 

Comment
  1. Yiannis Papadomichelakis
  2. Thursday, 4 June 2020 07:59 AM UTC
Well... you are right. The documentation is right there!

But now I am worried, how the GET methods worked?

Maybe the server did not returned compressed data?

I will come back if I find anything suspicious...!

  1. Helpful
  1. Mark Lee @Appeon
  2. Thursday, 4 June 2020 08:31 AM UTC
It seems that it is your local IIS express that doesn't support the gZip compression.

You can compare the two response headers you provided.

The response headers from your local IIS express doesn't include the "Content-Encoding: gzip" info.

So maybe the package returned by the Web service is not a compressed one.
  1. Helpful
  1. Yiannis Papadomichelakis
  2. Friday, 5 June 2020 13:31 PM UTC
...for some reason, my GET requests return uncompressed message bodies, while the rest (PUT, POST) return compressed bodies!!!

Nothing wrong with PB, my IIS needs some digging....

  1. Helpful
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 3 June 2020 14:55 PM UTC
  2. PowerBuilder
  3. # 1

I’m pretty sure the compression is only for downloads not uploads.  That would explain why not working for put/post.

Comment
  1. Yiannis Papadomichelakis
  2. Wednesday, 3 June 2020 15:04 PM UTC
Are you talking about the HttpClient object or the Http in general?

Postman (for example) is able to understand the compressed response body of a POST method.
  1. Helpful
  1. Armeen Mazda @Appeon
  2. Wednesday, 3 June 2020 16:10 PM UTC
HttpClient object
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.