In apache cxf, How do i know the soap request message is gzip compressed?

Posted by aspirant75 on Stack Overflow See other posts from Stack Overflow or by aspirant75
Published on 2012-08-14T10:44:22Z Indexed on 2012/09/20 21:38 UTC
Read the original article Hit count: 733

Filed under:
|
|
|

I'm using Apache CXF to send soap message. in specific case, i have to send a soap message gzip compressed.

Using log4j, i printed detailed info.

would you let me know how i can know the message is gzip compressed and transfered to server.

thanks in advance.

Below is my java code for gzip and log info.

java code

Client cxfClient = ClientProxy.getClient(port);
/** Logging Interceptor */
cxfClient.getInInterceptors().add(new GZIPInInterceptor());
cxfClient.getOutInterceptors().add(new GZIPOutInterceptor()); 

log info 20120814 18:56:15,351 DEBUG Interceptors contributed by bus: [] 20120814 18:56:15,351 DEBUG Interceptors contributed by client: [org.apache.cxf.transport.http.gzip.GZIPOutInterceptor@1682a53] 20120814 18:56:15,351 DEBUG Interceptors contributed by endpoint: [org.apache.cxf.interceptor.MessageSenderInterceptor@1b2d7df, org.apache.cxf.jaxws.interceptors.SwAOutInterceptor@7a9224, org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor@110b640, org.apache.cxf.jaxws.interceptors.HolderOutInterceptor@2d59a3] 20120814 18:56:15,351 DEBUG Interceptors contributed by binding: [org.apache.cxf.interceptor.AttachmentOutInterceptor@158015a, org.apache.cxf.interceptor.StaxOutInterceptor@c0c8b5, org.apache.cxf.binding.soap.interceptor.SoapHeaderOutFilterInterceptor@b914b3, org.apache.cxf.interceptor.BareOutInterceptor@fdfc58, org.apache.cxf.binding.soap.interceptor.SoapPreProtocolOutInterceptor@c22a3b, org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor@1629e71] 20120814 18:56:15,351 DEBUG Interceptors contributed by databinding: [] 20120814 18:56:15,357 DEBUG Adding interceptor org.apache.cxf.transport.http.gzip.GZIPOutInterceptor@1682a53 to phase prepare-send 20120814 18:56:15,358 DEBUG Adding interceptor org.apache.cxf.interceptor.MessageSenderInterceptor@1b2d7df to phase prepare-send 20120814 18:56:15,358 DEBUG Adding interceptor org.apache.cxf.jaxws.interceptors.SwAOutInterceptor@7a9224 to phase pre-logical 20120814 18:56:15,358 DEBUG Adding interceptor org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor@110b640 to phase pre-logical 20120814 18:56:15,358 DEBUG Adding interceptor org.apache.cxf.jaxws.interceptors.HolderOutInterceptor@2d59a3 to phase pre-logical 20120814 18:56:15,358 DEBUG Adding interceptor org.apache.cxf.interceptor.AttachmentOutInterceptor@158015a to phase pre-stream 20120814 18:56:15,358 DEBUG Adding interceptor org.apache.cxf.interceptor.StaxOutInterceptor@c0c8b5 to phase pre-stream 20120814 18:56:15,358 DEBUG Adding interceptor org.apache.cxf.binding.soap.interceptor.SoapHeaderOutFilterInterceptor@b914b3 to phase pre-logical 20120814 18:56:15,358 DEBUG Adding interceptor org.apache.cxf.interceptor.BareOutInterceptor@fdfc58 to phase marshal 20120814 18:56:15,358 DEBUG Adding interceptor org.apache.cxf.binding.soap.interceptor.SoapPreProtocolOutInterceptor@c22a3b to phase post-logical 20120814 18:56:15,359 DEBUG Adding interceptor org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor@1629e71 to phase write 20120814 18:56:15,360 DEBUG Chain org.apache.cxf.phase.PhaseInterceptorChain@31688f 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 org.apache.cxf.jaxws.interceptors.HolderOutInterceptor@2d59a3
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 org.apache.cxf.jaxws.interceptors.SwAOutInterceptor@7a9224
20120814 18:56:15,364       DEBUG                   Invoking handleMessage on interceptor org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor@110b640
20120814 18:56:15,364       DEBUG                   Invoking handleMessage on interceptor org.apache.cxf.binding.soap.interceptor.SoapHeaderOutFilterInterceptor@b914b3
20120814 18:56:15,365       DEBUG                   Invoking handleMessage on interceptor org.apache.cxf.binding.soap.interceptor.SoapPreProtocolOutInterceptor@c22a3b
20120814 18:56:15,365       DEBUG                   Invoking handleMessage on interceptor org.apache.cxf.interceptor.MessageSenderInterceptor@1b2d7df
20120814 18:56:15,365       DEBUG                   Adding interceptor org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor@dc9065 to phase prepare-send-ending
20120814 18:56:15,366       DEBUG                   Chain org.apache.cxf.phase.PhaseInterceptorChain@31688f 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 org.apache.cxf.transport.http.gzip.GZIPOutInterceptor@1682a53
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 org.apache.cxf.interceptor.AttachmentOutInterceptor@158015a
20120814 18:56:15,367       DEBUG                   Invoking handleMessage on interceptor org.apache.cxf.interceptor.StaxOutInterceptor@c0c8b5
20120814 18:56:15,370       DEBUG                   Adding interceptor org.apache.cxf.interceptor.StaxOutInterceptor$StaxOutEndingInterceptor@1f488f1 to phase pre-stream-ending
20120814 18:56:15,370       DEBUG                   Chain org.apache.cxf.phase.PhaseInterceptorChain@31688f 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 org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor@1629e71
20120814 18:56:15,383       DEBUG                   Adding interceptor org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor$SoapOutEndingInterceptor@1ce663c to phase write-ending
20120814 18:56:15,384       DEBUG                   Chain org.apache.cxf.phase.PhaseInterceptorChain@31688f 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 org.apache.cxf.interceptor.BareOutInterceptor@fdfc58
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.binding.soap.interceptor.SoapOutInterceptor$SoapOutEndingInterceptor@1ce663c
20120814 18:56:15,394       DEBUG                   Invoking handleMessage on interceptor org.apache.cxf.interceptor.StaxOutInterceptor$StaxOutEndingInterceptor@1f488f1
20120814 18:56:15,394       DEBUG                   Invoking handleMessage on interceptor org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor@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"]

© Stack Overflow or respective owner

Related posts about java

Related posts about web-services