You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by mabahma <ma...@hotmail.com> on 2012/08/08 15:31:59 UTC
Camel CXF Exception-Fault Handling
Hello
We have a client sending a request to a CXF WS endpoint
MessageContentsList messageContentsList = (MessageContentsList)
template.requestBodyAndHeaders( uri,message));
// wait for the route to complete
then Camel route the message to a processor where we check for Exceptions
like this :
} catch (Throwable xEx) {
fault = new Fault(xEx);
exchange.getOut().setFault(true);
exchange.getOut().setBody(new Object[] { "Exception raised ! KO" });
}
The porblem is that When an exception is thrown , the client doesn't receive
the message with the message "Exception raised ! KO"" we set in the body. We
get a empty response.
have we missed something ?
Kind regrads,
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-CXF-Exception-Fault-Handling-tp5716985.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel CXF Exception-Fault Handling
Posted by mabahma <ma...@hotmail.com>.
hi Willem
thank you for answering
this is m y route :
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<route id="route" xmlns="http://camel.apache.org/schema/spring">
<from uri="cxf:bean:mybean" />
<to uri="processor" />
</route>
CXF endpoint is in POJO mode :
<cxf:cxfEndpoint id="mybean" address="http://localhost:9000/services"
serviceClass="ch.test.MyServiceimpl">
<cxf:outInterceptors>
<ref bean="loggingOutInterceptor" />
</cxf:outInterceptors>
<cxf:properties>
<entry key="dataFormat" value="POJO" />
</cxf:properties>
</cxf:cxfEndpoint>
and the processor
<bean id="processor"
class="ch.test.MyProcessor">
</bean>
so i send a request to CXF endpoint like this :
MessageContentsList messageContentsList = (MessageContentsList)
template.requestBodyAndHeaders( uri,message));
, and when there is some Exceptions on the server, i get an empty message..
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-CXF-Exception-Fault-Handling-tp5716985p5716991.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel CXF Exception-Fault Handling
Posted by Willem jiang <wi...@gmail.com>.
Can I have a look at your route?
You said the client doesn't receive the response when the response, I think the client you means is a Camel route client, am I right?
--
Willem Jiang
FuseSource
Web: http://www.fusesource.com (http://www.fusesource.com/)
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
http://jnn.javaeye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang
Weibo: willemjiang
On Wednesday, August 8, 2012 at 9:31 PM, mabahma wrote:
> Hello
>
> We have a client sending a request to a CXF WS endpoint
>
> MessageContentsList messageContentsList = (MessageContentsList)
> template.requestBodyAndHeaders( uri,message));
> // wait for the route to complete
>
> then Camel route the message to a processor where we check for Exceptions
> like this :
>
>
> } catch (Throwable xEx) {
>
> fault = new Fault(xEx);
> exchange.getOut().setFault(true);
> exchange.getOut().setBody(new Object[] { "Exception raised ! KO" });
>
> }
>
> The porblem is that When an exception is thrown , the client doesn't receive
> the message with the message "Exception raised ! KO"" we set in the body. We
> get a empty response.
>
>
> have we missed something ?
> Kind regrads,
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-CXF-Exception-Fault-Handling-tp5716985.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).