【发布时间】:2014-11-11 09:41:32
【问题描述】:
我使用Spring 和CXF 创建了一个简单的soap web 服务。我现在正在尝试为 xml 请求启用 GZIP 压缩。
以下将接受压缩请求,但将响应未压缩。为什么?
@Component
@WebService
public class SoapService {
}
@Autowired
private SpringBus bus;
EndpointImpl end = new EndpointImpl(bus, new SoapService());
end.getFeatures().add(config.gzipFeature());
ep.publish("/SoapService");
对此 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], ...}
响应(空标头!!):
Content-Type: text/xml
Headers:
Payload: ...
为什么响应没有用 gzip 压缩?
【问题讨论】:
-
我会建议在soap body中发送xml消息作为压缩二进制数据的base64编码字符串,客户端客户端将解压这个编码字符串。
标签: java spring web-services soap cxf