camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: camel-cxf throwing a fault
Date Wed, 05 Mar 2008 08:26:41 GMT
Hi Marc,

It looks like camel-cxf component's issue which can't deal with the 
exception message in MESSAGE dataFormat.
Could you fill a JIRA for it ? I will fix it later this week.
As usual ,you just need throw the exception from the processor , CXF 
will try to marshal it into a soap fault.

Regards,
Willem

Marc Giger wrote:
> Hi,
>
> I'm trying to get the following camel route working where the
> dataformat is MESSAGE.
>
> <from uri="cxf:bean:routerEndpoint?dataFormat=MESSAGE"/>            
> <process ref="decryptProcessor"/>
> <choice>
>     <when>
>     	<methodCall bean="endpointSelector" method="matches"/>
> 	    <to uri="cxf:bean:serviceEndpoint?dataFormat=MESSAGE"/>
>     </when>
>     <otherwise>
>     	<to uri="cxf:bean:localEndpoint?dataFormat=MESSAGE"/> 
>     </otherwise>
> </choice>
>
> if the endpointSelector bean returns true the request is redirected to
> a remote webservice.
> otherwise the request is forwarded to a local cxf service (with
> local-transport)
>
> Now, if I invoke the routerEndpoint and somewhere in the pipeline
> happens an exception (in my case in the decryptProcessor), I get the
> following Exception in the outFault chain:
>
> Mar 4, 2008 10:48:35 PM org.apache.cxf.phase.PhaseInterceptorChain
> doIntercept INFO: Interceptor has thrown exception, unwinding now
> org.apache.cxf.interceptor.Fault
>         at
> org.apache.camel.component.cxf.interceptors.RawMessageContentRedirectInterceptor.handleMessage(RawMessageContentRedirectInterceptor.java:43)
> at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:208)
> at
> org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:74)
> at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:208)
> at
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:77)
> at
> org.apache.cxf.transport.servlet.ServletDestination.doMessage(ServletDestination.java:79)
> at
> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:264)
> at
> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)
> at
> org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:170)
> at
> org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFServlet.java:148)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at
> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
> at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
> at
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
> at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
> at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
> at
> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
> at
> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211)
> at
> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
> at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
> at org.mortbay.jetty.Server.handle(Server.java:313) at
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)
> at
> org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:844)
> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:644) at
> org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) at
> org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381) at
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396)
> at
> org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
> Caused by: java.lang.NullPointerException at
> org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1025) at
> org.apache.commons.io.IOUtils.copy(IOUtils.java:999) at
> org.apache.camel.component.cxf.interceptors.RawMessageContentRedirectInterceptor.handleMessage(RawMessageContentRedirectInterceptor.java:39)
...
> 28 more
>
> This is because the InputStream is null in
> RawMessageContentRedirectInterceptor:
>
> public void handleMessage(Message message) throws Fault {
>
>         InputStream is = message.getContent(InputStream.class);
>         OutputStream os = message.getContent(OutputStream.class);
>         
>         try {            
>             IOUtils.copy(is, os);
>             is.close();
>             os.flush();
>         } catch (Exception e) {
>             throw new Fault(e);
>         }
>     }
>
> How can I return a custom soap-fault in a processor/filter?
>
> Thanks,
>
> Marc
>
>   


Mime
View raw message