Is it documented in camel-cxf wiki page ? If this is not the case can you
please mention that info please


On Tue, Jan 22, 2013 at 4:37 PM, Willem Jiang <willem.ji...@gmail.com>wrote:

> Hi Charles,
> Setting the fault flag can tell camel-cxf consumer to treat the response
> as a fault message not a normal response. In this way the CXF fault
> interceptor chain can be used to generate the right soap fault instead of
> trying to marshal the exception object to XML.
>
> 发自我的 iPhone
>
> 在 2013-1-22,下午4:28,Charles Moulliard <ch0...@gmail.com> 写道:
>
> > In my route, the exception is intercepted and handled parameter is true,
> > that means that camel ErrorHandler will not retry
> >
> > onException(CamelAuthorizationException.class)
> >        .log(">> User not authorized")
> >        .handled(true)
> >                .process(new Processor() {
> >                    @Override
> >                    public void process(Exchange exchange) throws
> Exception {
> >                        String user = "jim";
> >                        NotAuthorizedUserFault notAuthorizedUserFault
> > = new NotAuthorizedUserFault();
> >                        NotAuthorizedUser notAuthorizedUser = new
> > NotAuthorizedUser();
> >                        notAuthorizedUser.setUser(user);
> >                        exchange.getOut().setBody(notAuthorizedUserFault);
> >                    }
> >                });
> >
> > So I don't really understand in this case the benefit to use
> setFault(true)
> >
> >
> >
> >
> >
> > On Tue, Jan 22, 2013 at 8:37 AM, Willem jiang <willem.ji...@gmail.com
> >wrote:
> >
> >> Hi Charles,
> >>
> >> Setting the Fault message could avoid the ErrorHandler retry action in
> the
> >> camel route.
> >> As the exception will be intercepted by the ErrorHandler by default.
> >> Fault message means you don't want to camel error handler to kick in.
> >>
> >>
> >> --
> >> Willem Jiang
> >>
> >> Red Hat, Inc.
> >> FuseSource is now part of Red Hat
> >> Web: http://www.fusesource.com | http://www.redhat.com
> >> Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/
> )
> >> (English)
> >>          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
> >> Twitter: willemjiang
> >> Weibo: 姜宁willem
> >>
> >>
> >>
> >>
> >>
> >> On Tuesday, January 22, 2013 at 3:31 PM, Charles Moulliard wrote:
> >>
> >>> Additional question about FAULT usage
> >>>
> >>> Camel allows to set the property setFault(true/false) on the IN or OUT
> >>> exchange. This mechanism (I think so) is inherited from Camel 1.x and
> was
> >>> coming from JBI specification (NMR). As setFault() property is not
> really
> >>> used today (as we can intercept exceptions, link them to the Exchange
> and
> >>> return it to the caller = from()), what is really the benefit to use
> >>> setFault() ? Why do we have to setFault for Camel-cxf when we generate
> a
> >>> Java Exception (= object that JAXB will convert to SOAP Body = Soap
> Error
> >>> Message) ?
> >>>
> >>>
> >>> On Mon, Jan 21, 2013 at 4:04 PM, Willem jiang <willem.ji...@gmail.com
> (mailto:
> >> willem.ji...@gmail.com)>wrote:
> >>>
> >>>> After some discussion with Charles, it turns out the fault message is
> >> not
> >>>> set up rightly, and we don't need to add the extra classes created to
> >>>> extend Exceptions into the JAXB context as CXFEndpoint does as the CXF
> >>>> fault out interceptor chain will take care of Fault message for us.
> >>>>
> >>>> If you want to setup an customer fault message to the camel-cxf
> >> consumer,
> >>>> Please take a look at example here[1].
> >>>>
> >>>> [1]
> >>
> https://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfCustomizedExceptionTest.java
> >>>>
> >>>> --
> >>>> Willem Jiang
> >>>>
> >>>> Red Hat, Inc.
> >>>> FuseSource is now part of Red Hat
> >>>> Web: http://www.fusesource.com | http://www.redhat.com
> >>>> Blog: http://willemjiang.blogspot.com (
> >> http://willemjiang.blogspot.com/)
> >>>> (English)
> >>>> http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
> >>>> Twitter: willemjiang
> >>>> Weibo: 姜宁willem
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> On Saturday, January 19, 2013 at 12:55 AM, Charles Moulliard wrote:
> >>>>
> >>>>> Hi,
> >>>>>
> >>>>> My camel cxf project uses SOAP fault and Exceptions classes. They are
> >>>>> generated by cxf 2.6.4 (camel used = 2.10.3)
> >>>>>
> >>>>> package com.redhat.fuse.example;
> >>>>>
> >>>>> import javax.xml.ws.WebFault;
> >>>>>
> >>>>> /**
> >>>>> * This class was generated by Apache CXF 2.6.4
> >>>>> * 2013-01-18T17:50:59.270+01:00
> >>>>> * Generated source version: 2.6.4
> >>>>> */
> >>>>>
> >>>>> @WebFault(name = "NoSuchCustomer", targetNamespace = "
> >>>>> http://example.fuse.redhat.com/";)
> >>>>> public class NoSuchCustomerException extends Exception {
> >>>>>
> >>>>> private com.redhat.fuse.example.NoSuchCustomer noSuchCustomer;
> >>>>>
> >>>>> Nevertheless when the camel cxf endpoint gets the object
> >>>>> (NoSuchCustomerException) to be transformed and next SOAP message
> >>>>
> >>>>
> >>>> created,
> >>>>> the following JAXB error is populated
> >>>>>
> >>>>> https://gist.github.com/6a64fffe39e63200e98a
> >>>>>
> >>>>> I have tried to add that in endpoint configuration but this is not
> >>>> allowed
> >>>>>
> >>>>> <cxf:cxfEndpoint id="WS"
> >>>>> address="http://0.0.0.0:9191/training/WebService";
> >>>>> serviceClass="com.redhat.fuse.example.CustomerService">
> >>>>> <cxf:outInterceptors>
> >>>>> <ref bean="loggingOutInterceptor"/>
> >>>>> </cxf:outInterceptors>
> >>>>> <cxf:inInterceptors>
> >>>>> <ref bean="loggingInInterceptor"/>
> >>>>> <ref bean="wss4jInInterceptor"/>
> >>>>> <ref bean="authenticationInterceptor"/>
> >>>>> </cxf:inInterceptors>
> >>>>> <cxf:properties>
> >>>>> <entry key="ws-security.validate.token" value="false"/>
> >>>>> <!-- Add extra classes created to extend Exceptions -->
> >>>>> <entry key="jaxb.additionalContextClasses">
> >>>>> <bean
> >>>>> class="org.apache.cxf.systest.jaxb.util.ClassArrayFactoryBean">
> >>>>> <property name="classNames">
> >>>>> <list>
> >>>>>
> >>>>> <value>com.redhat.fuse.example.NotAuthorizedUserException</value>
> >>>>>
> >>>>> <value>com.redhat.fuse.example.NoSuchCustomerException</value>
> >>>>> </list>
> >>>>> </property>
> >>>>> </bean>
> >>>>> </entry>
> >>>>> </cxf:properties>
> >>>>> </cxf:cxfEndpoint>
> >>>>>
> >>>>> Is there a trick ?
> >>>>>
> >>>>> Regards,
> >>>>>
> >>>>> --
> >>>>> Charles Moulliard
> >>>>> Apache Committer / Sr. Enterprise Architect (RedHat)
> >>>>> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
> >>>
> >>>
> >>>
> >>>
> >>> --
> >>> Charles Moulliard
> >>> Apache Committer / Sr. Enterprise Architect (RedHat)
> >>> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
> >
> >
> > --
> > Charles Moulliard
> > Apache Committer / Sr. Enterprise Architect (RedHat)
> > Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>



-- 
Charles Moulliard
Apache Committer / Sr. Enterprise Architect (RedHat)
Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com

Reply via email to