2014-11-11 1 views
3

SpringCXF을 사용하여 간단한 비누 웹 서비스를 만들었습니다. 이제 XML 요청에 대해 GZIP 압축을 사용하려고합니다. 다음은 압축 된 요청을 수락하지만 응답은 압축되지 않습니다. 왜? 이 SoapService에SOAP 응답에 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"); 

요청 :

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으로 압축되지 않는 이유는 무엇입니까?

+0

비누 몸체에 xml 메시지를 압축 바이너리 데이터의 base64 인코딩 문자열로 보내고 클라이언트 클라이언트가이 인코딩 된 문자열을 압축 해제 할 것을 제안합니다. –

답변

4

인터페이스에 @GZIP 주석을 추가해야합니다. Here's the documentation. 올바르게 기억한다면 스프링 설정에 GZIPOutInterceptor을 선언해야합니다.

또는 GZIPOutInterceptor을 수동으로 엔드 포인트에 추가 할 수 있습니다.

+1

자신을 인용 :'end.getFeatures(). add (config.gzipFeature());'이것은 수동으로 GZIPOutInterceptor를 수동으로 종점에 추가합니다. – membersound

+0

GZIPOutInterceptor 안에 중단 점을 지정하여 호출되는지 확인하는 것이 좋습니다. 어쩌면 문턱 크기에 도달하지 못했을 수도 있습니다. –

관련 문제