Reputation: 86905
I created a simple soap webservice using Spring
and CXF
. I'm now trying to enable GZIP compression for the xml requests.
The following will accept compressed requests, but will response uncompressed. Why?
@Component
@WebService
public class SoapService {
}
@Autowired
private SpringBus bus;
EndpointImpl end = new EndpointImpl(bus, new SoapService());
end.getFeatures().add(config.gzipFeature());
ep.publish("/SoapService");
Request to this SoapService:
Encoding: UTF-8
Http-Method: POST
Content-Type: text/xml;charset=UTF-8
Headers: {accept-encoding=[gzip,deflate], content-encoding=[gzip], connection=[Keep-Alive], content-type=[text/xml;charset=UTF-8], ...}
Response (empty headers!!):
Content-Type: text/xml
Headers:
Payload: ...
Why is the response not compressed with gzip?
Upvotes: 4
Views: 9448
Reputation: 4380
You need to add the @GZIP
annotation to your interface. Here's the documentation. If I remember correctly you need to have GZIPOutInterceptor
declared in your spring config.
Alternatively, you could add the GZIPOutInterceptor to your endpoint manually.
Upvotes: 4