Closed vprcic closed 4 years ago
Hi @vprcic thanks for raising this issue.
There is a bit of a strange behaviour in Apache XmlRpcClient
that I think might be a bug.
When you set
config.setGzipCompressing(true);
it will properly send the Content-Encoding: gzip
header in the HTTP request, however, it will not use proper writer when sending the actual request body - it will be sent uncompressed.
The logic for choosing the writer is in XmlRpcStreamTransport:
protected boolean isCompressingRequest(XmlRpcStreamRequestConfig pConfig) {
return pConfig.isEnabledForExtensions()
&& pConfig.isGzipCompressing();
}
So, in order for gzip compressing to work, you need to have extensions enabled in your config:
config.setGzipCompressing(true);
config.setEnabledForExtensions(true);
After enabling extensions in your config, your code works fine.
P.S.
Make sure to also enable gzip requesting (config.setGzipRequesting(true)
) that will set the Accept-Encoding: gzip
header, which is important if you want to have your responses also gzipped.
P.P.S.
You can troubleshoot your code more easily, if you enable debug
level logging in sfl4j (see simplelogger.properties
in integTest
) - in this case you will get detailed logs of the response, e.g. for the problem with gzip compressing, you'd get:
[DEBUG] RetryableXmlRpcClient - Calling method: ServerInfo, with params: []
[DEBUG] RetryableXmlRpcClient - Response: {seconds=0.002, status=parse error. not well formed}
Using the opensub4j v0.2.3 from mvnrepository gets me this error when trying to login:
This is my code: