Hello,
I'm porting my app to Tokyo from Rio. I'm calling a SOAP service which was imported through WSDL and to accept gzipped responses I had modified the OnBeforePost event like this:
procedure TMainForm.HTTPRIOHTTPWebNode1BeforePost(const HTTPReqResp: THTTPReqResp; Data: Pointer);
const
INTERNET_OPTION_HTTP_DECODING = 65;
contentEncodingHeader = 'Accept-Encoding: gzip, deflate';
var
Flag: LongBool;
begin
if( MyAppSettings.SoapGzipEnabled ) then
begin
Flag := True;
HttpAddRequestHeaders(Data, PChar(contentEncodingHeader), Length(contentEncodingHeader), HTTP_ADDREQ_FLAG_ADD);
InternetSetOption(Data, INTERNET_OPTION_HTTP_DECODING, PChar(@Flag), SizeOf(Flag));
end; //if
end; //proc
This worked like a charm in Seattle + Tokyo, result ot the method in SOAP envelope was gzipped according to MSNetMon and automatically unzipped in the returning ArrayOfItems.
Unfortunately, guys at EMBT changed OnBeforePost parameters from THTTPReqResp + Pointer to THTTPReqResp + THTTPClient. So I modified my OnBeforePost event to this:
procedure TMainForm.HTTPRIOHTTPWebNode1BeforePost(const HTTPReqResp: THTTPReqResp; Client: THTTPClient);
begin
if( MyAppSettings.SoapGzipEnabled ) then
begin
Client.AcceptEncoding := 'gzip, deflate';
end; //if
end; //proc
According to MSNetMon, the returned SOAP envelope is gzipped and has the same size as when called the old method in Seattle and Tokyo, so I think so far so good. The problem is I get EDOMParseError 'An invalid character was found at Line 1' and that's all 😞 When I remove the Client.AcceptEncoding line, everything works, just the result is a plain xml with a size of 3MB (gzipped is 65kB), so gzippid is a must.
Any idea what can be wrong? I think I'm missing something but can't find it. Thanks in advance!