camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Moulliard <ch0...@gmail.com>
Subject Re: How to avoid that "" with camel cxf
Date Tue, 22 Jan 2013 07:31:11 GMT
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.jiang@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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message