camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raúl Kripalani <r...@fusesource.com>
Subject Re: [IDEA] - camel-cxf, make it easier to enable logging in/out
Date Tue, 08 Nov 2011 12:18:05 GMT
Exactly, that's the special case I'm referring to.


The LoggingOutInterceptor attaches itself to the PRE_STREAM phase of the
interception chain. Apparently, this phase is not executed when
dataFormat=MESSAGE on the CXF endpoint.

So by passing the string "write" to the constructor, you tell the
interceptor to attach itself to the WRITE phase, which *is* executed when
dataFormat=MESSAGE.

I verified this behaviour some days ago and I can attest to it ;)

Regards,
Raúl.

On 08/11/2011 11:46, "Claus Ibsen" <claus.ibsen@gmail.com> wrote:

>2011/11/8 Raúl Kripalani <raul@fusesource.com>:
>> Hi,
>>
>> Sounds very convenient.
>>
>> Special care must be taken when dataFormat=MESSAGE
>> 
>>(http://camel.apache.org/cxf.html#CXF-HowtoenableCXF%2527sLoggingOutInter
>>ce
>> ptorinMESSAGEmode).
>>
>> Shall we also allow the user to specify the limit, as per the
>> Logging*Interceptor(int) constructors? Otherwise, it defaults to 100
>>bytes.
>>
>
>The special care you refer to, is this code below? Where you have to
>pass in true in the ctr?
>
>  <bean id="loggingOutInterceptor"
>class="org.apache.cxf.interceptor.LoggingOutInterceptor">
>        <!--  it really should have been user-prestream but CXF does
>have such phase! -->
>        <constructor-arg value="write"/>
>   </bean>
>   		
>
>So what happens in non MESSAGE mode (eg PAYLOAD or POJO) and you pass
>in true in the ctr?
>eg can we just always pass in true?
>
>
>
>
>> Regards,
>> Raúl.
>>
>>
>> On 08/11/2011 10:43, "Willem Jiang" <willem.jiang@gmail.com> wrote:
>>
>>>Hi Claus,
>>>
>>>CXF has the log feature can avoid us to configure lots of interceptors.
>>>but it could be more handy if we add an attribute on the cxfEndpoint.
>>>
>>>+1 for this idea.
>>>
>>>
>>>On Tue Nov  8 18:36:27 2011, Claus Ibsen wrote:
>>>> Hi
>>>>
>>>> When working with camel-cxf, you can get pretty fast setup with the
>>>> Camel cxfEndpoint element as shown:
>>>>
>>>> For example to call the famous weather web service
>>>>
>>>>    <cxf:cxfEndpoint id="weatherWebService"
>>>>
>>>>address="http://www.webservicex.net/globalweather.asmx"
>>>>                     endpointName="s:GlobalWeatherSoap"
>>>>                     serviceName="s:GlobalWeather"
>>>>
>>>>wsdlURL="http://www.webservicex.net/globalweather.asmx?WSDL"
>>>>                     xmlns:s="http://www.webserviceX.NET">
>>>>
>>>>
>>>> However to enabling logging of INBOUND and OUTBOUND messages with CXF,
>>>> you need to thinker with interceptors.
>>>> And IMHO that is a bit PITA as its kinda hard to remember all the
>>>> mighty XML stuff you need to add, just to see what is send out and
>>>> comes back in the console / logs.
>>>>
>>>> Currently you would have to added these 4 interceptors, and remember
>>>> also what the class names of the interceptor bean is
>>>>
>>>>    <cxf:cxfEndpoint id="weatherWebService"
>>>>
>>>>address="http://www.webservicex.net/globalweather.asmx"
>>>>                     endpointName="s:GlobalWeatherSoap"
>>>>                     serviceName="s:GlobalWeather"
>>>>
>>>>wsdlURL="http://www.webservicex.net/globalweather.asmx?WSDL"
>>>>                     xmlns:s="http://www.webserviceX.NET">
>>>>
>>>>          <cxf:inInterceptors>
>>>>              <bean
>>>>class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>>>>          </cxf:inInterceptors>
>>>>          <cxf:inFaultInterceptors>
>>>>              <bean
>>>>class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>>>>          </cxf:inFaultInterceptors>
>>>>          <cxf:outInterceptors>
>>>>              <bean
>>>>class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>>>>          </cxf:outInterceptors>
>>>>          <cxf:outFaultInterceptors>
>>>>              <bean
>>>>class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>>>>          </cxf:outFaultInterceptors>
>>>>
>>>>    </cxf:cxfEndpoint>
>>>>
>>>>
>>>> Thats is a lot of XML just to play with a web service.
>>>>
>>>> It would be much easier if there was a attribute that could setup
>>>> these logging interceptors for you out of the box. So all you have to
>>>> do was set logging attribute to true.
>>>>
>>>>    <cxf:cxfEndpoint id="weatherWebService"
>>>>                     logging="true"
>>>>
>>>>address="http://www.webservicex.net/globalweather.asmx"
>>>>                     endpointName="s:GlobalWeatherSoap"
>>>>                     serviceName="s:GlobalWeather"
>>>>
>>>>wsdlURL="http://www.webservicex.net/globalweather.asmx?WSDL"
>>>>                     xmlns:s="http://www.webserviceX.NET">
>>>>
>>>>
>>>> Any thoughts?
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>--
>>>Willem
>>>----------------------------------
>>>FuseSource
>>>Web: http://www.fusesource.com
>>>Blog:    http://willemjiang.blogspot.com (English)
>>>         http://jnn.javaeye.com (Chinese)
>>>Twitter: willemjiang
>>>Weibo: willemjiang
>>>
>>
>>
>>
>
>
>
>-- 
>Claus Ibsen
>-----------------
>FuseSource
>Email: cibsen@fusesource.com
>Web: http://fusesource.com
>Twitter: davsclaus, fusenews
>Blog: http://davsclaus.blogspot.com/
>Author of Camel in Action: http://www.manning.com/ibsen/



Mime
View raw message