【发布时间】:2012-09-21 02:08:28
【问题描述】:
我正在尝试让我的客户使用 gzip。我在服务器中启用了 GZip 功能。似乎客户端没有发送正确的标头:
POST /api/v1/data HTTP/1.1
Content-Type: text/xml; charset=UTF-8
Accept: */*
SOAPAction: ""
User-Agent: Apache CXF 2.6.2
Cache-Control: no-cache
Pragma: no-cache
Host: localhost:8001
Connection: keep-alive
Content-Length: 539
这是我创建客户端的代码:
private static final QName SERVICE_NAME = new QName(
"http://xxx/", "IData");
private static final QName PORT_NAME = new QName(
"http://xxx/", "IDataPort");
IData port;
public void initPort() {
Service service = Service.create(SERVICE_NAME);
// Endpoint Address
String endpointAddress = ClientUtil.getUrl()
+ "data";
// Add a port to the Service
service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING,
endpointAddress);
port = service.getPort(IData.class);
}
IData 接口实现了 GZip Annotation:
@WebService
@GZIP
public interface IData ....
【问题讨论】:
-
标头是否来自某些网络分析器,例如 tcpmon?
-
我正在使用 Grinder 代理连接并获取流量转储。
标签: java web-services cxf