我正在使用Apache CXF發送SOAP消息。 在特定情況下,我必須發送gzip壓縮的SOAP消息。在apache cxf中,我怎麼知道SOAP請求消息是gzip壓縮的?
使用log4j,我打印了詳細信息。
我怎樣才能知道消息是gzip壓縮並傳輸到服務器?
下面是我的gzip和日誌信息的Java代碼。
Java代碼
Client cxfClient = ClientProxy.getClient(port);
/** Logging Interceptor */
cxfClient.getInInterceptors().add(new GZIPInInterceptor());
cxfClient.getOutInterceptors().add(new GZIPOutInterceptor());
日誌信息
20120814 18:56:15,351 DEBUG Interceptors contributed by bus: []
20120814 18:56:15,351 DEBUG Interceptors contributed by client: [[email protected]]
20120814 18:56:15,351 DEBUG Interceptors contributed by endpoint: [[email protected], [email protected], [email protected]b640, [email protected]]
20120814 18:56:15,351 DEBUG Interceptors contributed by binding: [[email protected], [email protected], org.apa[email protected]b914b3, [email protected], org.ap[email protected]c22a3b, [email protected]71]
20120814 18:56:15,351 DEBUG Interceptors contributed by databinding: []
20120814 18:56:15,357 DEBUG Adding interceptor [email protected] to phase prepare-send
20120814 18:56:15,358 DEBUG Adding interceptor [email protected] to phase prepare-send
20120814 18:56:15,358 DEBUG Adding interceptor [email protected] to phase pre-logical
20120814 18:56:15,358 DEBUG Adding interceptor [email protected]b640 to phase pre-logical
20120814 18:56:15,358 DEBUG Adding interceptor [email protected] to phase pre-logical
20120814 18:56:15,358 DEBUG Adding interceptor [email protected] to phase pre-stream
20120814 18:56:15,358 DEBUG Adding interceptor [email protected] to phase pre-stream
20120814 18:56:15,358 DEBUG Adding interceptor org.apa[email protected]b914b3 to phase pre-logical
20120814 18:56:15,358 DEBUG Adding interceptor [email protected] to phase marshal
20120814 18:56:15,358 DEBUG Adding interceptor org.ap[email protected]c22a3b to phase post-logical
20120814 18:56:15,359 DEBUG Adding interceptor org.apache.cxf.binding.soap.inte[email protected] to phase write
20120814 18:56:15,360 DEBUG Chain [email protected] was created. Current flow:
pre-logical [HolderOutInterceptor, SwAOutInterceptor, WrapperClassOutInterceptor, SoapHeaderOutFilterInterceptor]
post-logical [SoapPreProtocolOutInterceptor]
prepare-send [MessageSenderInterceptor, GZIPOutInterceptor]
pre-stream [AttachmentOutInterceptor, StaxOutInterceptor]
write [SoapOutInterceptor]
marshal [BareOutInterceptor]
20120814 18:56:15,361 DEBUG Invoking handleMessage on interceptor [email protected]
20120814 18:56:15,361 DEBUG op: [OperationInfo: {https://asp.cyberbooking.co.kr/TopasApiSvc/services}getAirAvail]
20120814 18:56:15,361 DEBUG op.hasOutput(): true
20120814 18:56:15,361 DEBUG op.getOutput().size(): 2
20120814 18:56:15,361 DEBUG Invoking handleMessage on interceptor [email protected]
20120814 18:56:15,364 DEBUG Invoking handleMessage on interceptor [email protected]b640
20120814 18:56:15,364 DEBUG Invoking handleMessage on interceptor org.apa[email protected]b914b3
20120814 18:56:15,365 DEBUG Invoking handleMessage on interceptor org.ap[email protected]c22a3b
20120814 18:56:15,365 DEBUG Invoking handleMessage on interceptor org.apache.cxf.[email protected]
20120814 18:56:15,365 DEBUG Adding interceptor org.apache.cxf.inte[email protected]dc9065 to phase prepare-send-ending
20120814 18:56:15,366 DEBUG Chain [email protected] was modified. Current flow:
pre-logical [HolderOutInterceptor, SwAOutInterceptor, WrapperClassOutInterceptor, SoapHeaderOutFilterInterceptor]
post-logical [SoapPreProtocolOutInterceptor]
prepare-send [MessageSenderInterceptor, GZIPOutInterceptor]
pre-stream [AttachmentOutInterceptor, StaxOutInterceptor]
write [SoapOutInterceptor]
marshal [BareOutInterceptor]
prepare-send-ending [MessageSenderEndingInterceptor]
20120814 18:56:15,366 DEBUG Invoking handleMessage on interceptor [email protected]
20120814 18:56:15,366 DEBUG Requestor role, so gzip enabled
20120814 18:56:15,366 DEBUG gzip permitted: YES
20120814 18:56:15,367 DEBUG Invoking handleMessage on interceptor [email protected]
20120814 18:56:15,367 DEBUG Invoking handleMessage on interceptor [email protected]
20120814 18:56:15,370 DEBUG Adding interceptor org.apa[email protected]1f488f1 to phase pre-stream-ending
20120814 18:56:15,370 DEBUG Chain [email protected] was modified. Current flow:
pre-logical [HolderOutInterceptor, SwAOutInterceptor, WrapperClassOutInterceptor, SoapHeaderOutFilterInterceptor]
post-logical [SoapPreProtocolOutInterceptor]
prepare-send [MessageSenderInterceptor, GZIPOutInterceptor]
pre-stream [AttachmentOutInterceptor, StaxOutInterceptor]
write [SoapOutInterceptor]
marshal [BareOutInterceptor]
pre-stream-ending [StaxOutEndingInterceptor]
prepare-send-ending [MessageSenderEndingInterceptor]
20120814 18:56:15,370 DEBUG Invoking handleMessage on interceptor [email protected]71
20120814 18:56:15,383 DEBUG Adding interceptor org.apache.cxf.bindi[email protected]1ce663c to phase write-ending
20120814 18:56:15,384 DEBUG Chain [email protected] was modified. Current flow:
pre-logical [HolderOutInterceptor, SwAOutInterceptor, WrapperClassOutInterceptor, SoapHeaderOutFilterInterceptor]
post-logical [SoapPreProtocolOutInterceptor]
prepare-send [MessageSenderInterceptor, GZIPOutInterceptor]
pre-stream [AttachmentOutInterceptor, StaxOutInterceptor]
write [SoapOutInterceptor]
marshal [BareOutInterceptor]
write-ending [SoapOutEndingInterceptor]
pre-stream-ending [StaxOutEndingInterceptor]
prepare-send-ending [MessageSenderEndingInterceptor]
20120814 18:56:15,384 DEBUG Invoking handleMessage on interceptor [email protected]
20120814 18:56:15,387 DEBUG Compressing message.
20120814 18:56:15,388 DEBUG Sending POST Message with Headers to http://test.co.kr:80/###/###/###Conduit :{https://test.co.kr/###/####}###.http-conduit
Content-Type: text/xml; charset=UTF-8
20120814 18:56:15,388 DEBUG SOAPAction: "getAirAvail"
20120814 18:56:15,388 DEBUG Accept: */*
20120814 18:56:15,388 DEBUG Accept-Encoding: gzip;q=1.0, identity; q=0.5, *;q=0
20120814 18:56:15,388 DEBUG Content-Encoding: gzip
20120814 18:56:15,388 DEBUG No Trust Decider for Conduit '{https://test.co.kr/###/###}###.http-conduit'. An afirmative Trust Decision is assumed.
20120814 18:56:15,394 DEBUG Invoking handleMessage on interceptor org.apache.cxf.bindi[email protected]1ce663c
20120814 18:56:15,394 DEBUG Invoking handleMessage on interceptor org.apa[email protected]1f488f1
20120814 18:56:15,394 DEBUG Invoking handleMessage on interceptor org.apache.cxf.inte[email protected]dc9065
20120814 18:56:15,459 DEBUG Response Code: 200 Conduit: {https://test.co.kr/###/###}###.http-conduit
20120814 18:56:15,459 DEBUG Content length: 11034
20120814 18:56:15,459 DEBUG Header fields:
null: [HTTP/1.1 200 OK]
Content-Language: [ko-KR]
Date: [Tue, 14 Aug 2012 09:56:15 GMT]
Content-Length: [11034]
P3P: [CP='CAO PSA CONi OTR OUR DEM ONL']
Expires: [Thu, 01 Dec 1994 16:00:00 GMT]
Keep-Alive: [timeout=10, max=100]
Set-Cookie: [WMONID=mL6rq_Irpa_; Expires=Wed, 14 Aug 2013 09:56:15 GMT; Path=/]
Connection: [Keep-Alive]
Content-Type: [text/xml; charset=utf-8]
Server: [IBM_HTTP_Server]
Cache-Control: [no-cache="set-cookie, set-cookie2"]
您是否找到解決方案?我會對同樣的要求感興趣。 – membersound 2014-11-12 08:20:52