You can use try()… catch() to build a SOAP fault like this
.doTry()
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
throw new IllegalStateException();
}
})
.doCatch(IllegalStateException.class).process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
// Create the SOAPFault here
UnknownPersonFault faultDetail = new UnknownPersonFault();
faultDetail.setPersonId("");
UnknownPersonFault fault = new UnknownPersonFault("Get the null value of person 
name", faultDetail);
exchange.getOut().setBody(fault);
exchange.getOut().setFault(true);
}
})
.end();


--  
Willem Jiang

Red Hat, Inc.
Web: 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


Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


On Thursday, November 7, 2013 at 6:26 PM, Delanghe Stefaan wrote:

> Hey,
>  
> First i am new to Camel. Hope not for long. :)
> A question regarding the exception arise for my current project.
>  
> When I catch a particular exception
> onException(SocketTimeOutException.class)
>  
> How can I convert this exception to a soapfault?
>  
> Kind regards,
> Stefaan



Reply via email to