exchange.getIn().On 07/03/2010 07:05, Claus Ibsen wrote:
Hi

You can enable the soapFault=true on the CamelContext which turns
faults into exceptions.

Or you can simply add a processor step at the end of your route, and
check if the exchange is a fault

public void process(Exchange exchange) {
boolean isFault = exchange.hasOut()&&  exchange.getOut().isFault();
// do something before the OUT message is returned to the caller
}
Putting on the extra process step works (I didn't know you could do that, I'd assumed that InOut routes were stack-like, but I guess they're actually more like a loop given that they end up back at the source from).

But neither context.setHandleFault(true) nor from("xxx").handleFault().to("yyy") work - my onException is never called and the soap:fault is returned to the client.
I think the problem is that the CXF transport isn't setting it as a fault.
My debug logs looks like this (reformatted by hand):
exchange.isFailed() = false
exchange.getIn().isFault() = false
exchange.getOut().isFault() = false
exchange.getIn() = sun.net.www.protocol.http.httpurlconnection$httpinputstr...@34c95
exchange.getOut() = Message: [Body is null]
exchange.getIn().header[ content-type ] = text/xml; charset=utf-8
exchange.getIn().header[ connection ] = keep-alive
exchange.getIn().header[ host ] = 192.168.1.198:9000
exchange.getIn().header[ accept ] = */*
exchange.getIn().header[ user-agent ] = Apache CXF 2.2.6
exchange.getIn().header[ date ] = Sun, 07 Mar 2010 20:02:50 GMT
exchange.getIn().header[ pragma ] = no-cache
exchange.getIn().header[ cache-control ] = private
exchange.getIn().header[ x-powered-by ] = ASP.NET
exchange.getIn().header[ soapaction ] = "http://spudsoft.co.uk/HashFiles";
exchange.getIn().header[ x-aspnet-version ] = 2.0.50727
exchange.getIn().header[ content-length ] = 394
exchange.getIn().header[ server ] = Microsoft-IIS/6.0
exchange.getIn().header[ responsecontext ] = {
    org.apache.cxf.client=true,
    org.apache.cxf.message.Message.PROTOCOL_HEADERS={
        content-type=[text/xml; charset=utf-8],
        X-AspNet-Version=[2.0.50727],
        Date=[Sun, 07 Mar 2010 20:02:50 GMT],
        Content-Length=[394],
        X-Powered-By=[ASP.NET],
        Server=[Microsoft-IIS/6.0],
        Cache-Control=[private]
        },
    org.apache.cxf.message.inbound=true,
    Content-Type=text/xml;
    charset=utf-8,
    org.apache.cxf.message.Message.RESPONSE_CODE=500,
    org.apache.cxf.message.Message.ENCODING=UTF-8
}

It's setting the RESPONSE_CODE to 500, but not raising an exception or setting isFault.
Is that a bug?

Jim

Reply via email to