You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Castyn <er...@gmail.com> on 2012/04/04 20:36:37 UTC

Detecting SOAP Faults

I currently have a custom processor setup within a route that does the
following


public class SoapFaultDetectionProcessor implements Processor {

	public void process(Exchange exchange) throws Exception {
		if(exchange.getIn().isFault()) {
			SoapFault fault = exchange.getIn().getBody(SoapFault.class);
	        System.out.println(fault.getMessage());
		}
	}
}

This processor immediately follows a CXF Producer in POJO mode.  I am having
the service generate a soap fault, but for some reason the isFault() call
always remains false.  

1) Am I not using this properly or
2) Is there a better way to capture and manipulate / display SOAP faults
(for logging purposes and such)

--
View this message in context: http://camel.465427.n5.nabble.com/Detecting-SOAP-Faults-tp5618665p5618665.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Detecting SOAP Faults

Posted by Willem Jiang <wi...@gmail.com>.
camel-cxf leverage the CXF soap stack by redirect the invocation of the 
method to the camel route.

ServiceMix is using the cxf-bc to handle the transport lever work and 
cxf-se to parser the soap message.

On 4/6/12 10:24 AM, Castyn wrote:
> I actually do have validation enabled on the CXF consumer in the properties
> with the schema-validation-enabled which I guess is why it returns a SOAP
> fault to the calling client and not something else.
>
> I didn't realize a CXF consumer never technically enters a route unless the
> consumer parse is successful, that is good to know.  I know I can generate
> and view faults once in the route or even after the CXF Producer in my route
> that happens later, I was just hoping for more of a window into the entire
> pipeline.
>
> Any ideas why Servicemix generates so much error text for a SOAP fault or
> how to make it less verbose?
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Detecting-SOAP-Faults-tp5618665p5621874.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> .
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Re: Detecting SOAP Faults

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Apr 6, 2012 at 4:24 AM, Castyn <er...@gmail.com> wrote:
> I actually do have validation enabled on the CXF consumer in the properties
> with the schema-validation-enabled which I guess is why it returns a SOAP
> fault to the calling client and not something else.
>
> I didn't realize a CXF consumer never technically enters a route unless the
> consumer parse is successful, that is good to know.  I know I can generate
> and view faults once in the route or even after the CXF Producer in my route
> that happens later, I was just hoping for more of a window into the entire
> pipeline.
>
> Any ideas why Servicemix generates so much error text for a SOAP fault or
> how to make it less verbose?
>

Yes I dislike that as well. Its Apache CXF doing this by default to
log this big WARN with stacktrace, in a confusing error message about
unwinding now. At least IMHO there should be a option to change the
logging level.

> --
> View this message in context: http://camel.465427.n5.nabble.com/Detecting-SOAP-Faults-tp5618665p5621874.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Detecting SOAP Faults

Posted by Castyn <er...@gmail.com>.
I actually do have validation enabled on the CXF consumer in the properties
with the schema-validation-enabled which I guess is why it returns a SOAP
fault to the calling client and not something else.  

I didn't realize a CXF consumer never technically enters a route unless the
consumer parse is successful, that is good to know.  I know I can generate
and view faults once in the route or even after the CXF Producer in my route
that happens later, I was just hoping for more of a window into the entire
pipeline.

Any ideas why Servicemix generates so much error text for a SOAP fault or
how to make it less verbose? 

--
View this message in context: http://camel.465427.n5.nabble.com/Detecting-SOAP-Faults-tp5618665p5621874.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Detecting SOAP Faults

Posted by Raul Kripalani <ra...@fusesource.com>.
It looks like your client is sending an invalid SOAP message. Since
JAXB cannot parse the Boolean value, the processing stops inside the
CXF consumer before even hitting the Camel route.

In fact, the error is not being handled gracefully because incoming
XML schema validation is not enabled on the CXF endpoint. Check out
http://cxf.apache.org/faq.html#FAQ-HowcanIturnonschemavalidationforjaxwsendpoint%3F.

Try sending valid XML from the client and simulate a SOAP fault
returned by the endpoint that the CXF producer invokes.

HTH,
Raúl Kripalani.

On 5 Apr 2012, at 19:06, Castyn <er...@gmail.com> wrote:

> I have done a bit more testing with this and seem to not be able to actually
> catch SOAP faults as exceptions.
>
> Lets say my CXF consumer throws the following in my route:
>
>
> 13:58:57,419 | WARN  | qtp50072751-7150 | PhaseInterceptorChain            |
> ?                                   ? |  -  -  | Interceptor for
> {http://webservice.ihg.com}JavelinInitiateServiceService#{http://webservice.ihg.com}addAccount
> has thrown exception, unwinding now
> org.apache.cxf.interceptor.Fault: Unmarshalling Error: String "TRUE" is not
> valid boolean value.
>        at
> org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:801)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
>        at
> org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:642)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
>        at
> org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:156)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
>        at
> org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:109)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
>        at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
>        at
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
>        at
> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:319)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
>        at
> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:287)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
>        at
> org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:72)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
>        at
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:939)[114:org.eclipse.jetty.server:7.4.5.fuse20111017]
>        at
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:875)[114:org.eclipse.jetty.server:7.4.5.fuse20111017]
>        at
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)[114:org.eclipse.jetty.server:7.4.5.fuse20111017]
>        at
> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:247)[114:org.eclipse.jetty.server:7.4.5.fuse20111017]
>        at
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)[114:org.eclipse.jetty.server:7.4.5.fuse20111017]
>        at
> org.eclipse.jetty.server.Server.handle(Server.java:346)[114:org.eclipse.jetty.server:7.4.5.fuse20111017]
>        at
> org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:438)[114:org.eclipse.jetty.server:7.4.5.fuse20111017]
>        at
> org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:922)[114:org.eclipse.jetty.server:7.4.5.fuse20111017]
>        at
> org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:780)[109:org.eclipse.jetty.http:7.4.5.fuse20111017]
>        at
> org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:220)[109:org.eclipse.jetty.http:7.4.5.fuse20111017]
>        at
> org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:43)[114:org.eclipse.jetty.server:7.4.5.fuse20111017]
>        at
> org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:538)[110:org.eclipse.jetty.io:7.4.5.fuse20111017]
>        at
> org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:43)[110:org.eclipse.jetty.io:7.4.5.fuse20111017]
>        at
> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:529)[115:org.eclipse.jetty.util:7.4.5.fuse20111017]
>        at java.lang.Thread.run(Thread.java:662)[:1.6.0_23]
> Caused by: javax.xml.bind.UnmarshalException
> - with linked exception:
> [javax.xml.bind.UnmarshalException: String "TRUE" is not valid boolean
> value.
> - with linked exception:
> [java.lang.IllegalArgumentException: String "TRUE" is not valid boolean
> value.]]
>        at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:425)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
>        at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:362)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
>        at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:339)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
>        at
> org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:778)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
>        ... 23 more
> Caused by: javax.xml.bind.UnmarshalException: String "TRUE" is not valid
> boolean value.
> - with linked exception:
> [java.lang.IllegalArgumentException: String "TRUE" is not valid boolean
> value.]
>        at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:642)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
>        at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleError(UnmarshallingContext.java:671)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
>        at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleError(UnmarshallingContext.java:667)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
>        at
> com.sun.xml.bind.v2.runtime.unmarshaller.Loader.handleParseConversionException(Loader.java:267)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
>        at
> com.sun.xml.bind.v2.runtime.unmarshaller.TextLoader.text(TextLoader.java:69)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
>        at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.text(UnmarshallingContext.java:494)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
>        at
> com.sun.xml.bind.v2.runtime.unmarshaller.ValidatingUnmarshaller.text(ValidatingUnmarshaller.java:125)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
>        at
> com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.processText(StAXStreamConnector.java:334)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
>        at
> com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleEndElement(StAXStreamConnector.java:212)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
>        at
> com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:181)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
>        at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:360)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
>        ... 25 more
> Caused by: javax.xml.bind.UnmarshalException: String "TRUE" is not valid
> boolean value.
> - with linked exception:
> [java.lang.IllegalArgumentException: String "TRUE" is not valid boolean
> value.]
>        ... 36 more
> Caused by: java.lang.IllegalArgumentException: String "TRUE" is not valid
> boolean value.
>        at
> com.sun.xml.bind.DatatypeConverterImpl._parseBoolean(DatatypeConverterImpl.java:314)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
>        at
> com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$13.parse(RuntimeBuiltinLeafInfoImpl.java:666)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
>        at
> com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$13.parse(RuntimeBuiltinLeafInfoImpl.java:669)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
>        at
> com.sun.xml.bind.v2.runtime.unmarshaller.TextLoader.text(TextLoader.java:65)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
>        ... 31 more
>
>
> I tried to catch the both the fault and then when that didn't work, the
> global java exception just to get a result, but neither seem to catch this.
>
> My route is
>
> <route id="JavelinInitiateService">
>  <from uri="cxf:bean:initiateCXFConsumer" />
>    <onException>
>      <exception>java.lang.Exception</exception>
>      <handled><constant>true</constant></handled>
>      <log message="generic exception" />
>     </onException>
>     <onException>
>      <exception>org.apache.cxf.interceptor.Fault</exception>
>      <handled><constant>true</constant></handled>
>      <log message="cxf fault" />
>    </onException>
>  <to uri="cxf:bean:initiateCXFProducer"/>
> </route>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Detecting-SOAP-Faults-tp5618665p5621045.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Detecting SOAP Faults

Posted by Castyn <er...@gmail.com>.
I have done a bit more testing with this and seem to not be able to actually
catch SOAP faults as exceptions.

Lets say my CXF consumer throws the following in my route:


13:58:57,419 | WARN  | qtp50072751-7150 | PhaseInterceptorChain            |
?                                   ? |  -  -  | Interceptor for
{http://webservice.ihg.com}JavelinInitiateServiceService#{http://webservice.ihg.com}addAccount
has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Unmarshalling Error: String "TRUE" is not
valid boolean value.
        at
org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:801)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
        at
org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:642)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
        at
org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:156)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
        at
org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:109)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
        at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
        at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
        at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:319)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
        at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:287)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
        at
org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:72)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
        at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:939)[114:org.eclipse.jetty.server:7.4.5.fuse20111017]
        at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:875)[114:org.eclipse.jetty.server:7.4.5.fuse20111017]
        at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)[114:org.eclipse.jetty.server:7.4.5.fuse20111017]
        at
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:247)[114:org.eclipse.jetty.server:7.4.5.fuse20111017]
        at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)[114:org.eclipse.jetty.server:7.4.5.fuse20111017]
        at
org.eclipse.jetty.server.Server.handle(Server.java:346)[114:org.eclipse.jetty.server:7.4.5.fuse20111017]
        at
org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:438)[114:org.eclipse.jetty.server:7.4.5.fuse20111017]
        at
org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:922)[114:org.eclipse.jetty.server:7.4.5.fuse20111017]
        at
org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:780)[109:org.eclipse.jetty.http:7.4.5.fuse20111017]
        at
org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:220)[109:org.eclipse.jetty.http:7.4.5.fuse20111017]
        at
org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:43)[114:org.eclipse.jetty.server:7.4.5.fuse20111017]
        at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:538)[110:org.eclipse.jetty.io:7.4.5.fuse20111017]
        at
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:43)[110:org.eclipse.jetty.io:7.4.5.fuse20111017]
        at
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:529)[115:org.eclipse.jetty.util:7.4.5.fuse20111017]
        at java.lang.Thread.run(Thread.java:662)[:1.6.0_23]
Caused by: javax.xml.bind.UnmarshalException
 - with linked exception:
[javax.xml.bind.UnmarshalException: String "TRUE" is not valid boolean
value.
 - with linked exception:
[java.lang.IllegalArgumentException: String "TRUE" is not valid boolean
value.]]
        at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:425)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
        at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:362)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
        at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:339)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
        at
org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:778)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
        ... 23 more
Caused by: javax.xml.bind.UnmarshalException: String "TRUE" is not valid
boolean value.
 - with linked exception:
[java.lang.IllegalArgumentException: String "TRUE" is not valid boolean
value.]
        at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:642)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
        at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleError(UnmarshallingContext.java:671)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
        at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleError(UnmarshallingContext.java:667)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
        at
com.sun.xml.bind.v2.runtime.unmarshaller.Loader.handleParseConversionException(Loader.java:267)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
        at
com.sun.xml.bind.v2.runtime.unmarshaller.TextLoader.text(TextLoader.java:69)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
        at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.text(UnmarshallingContext.java:494)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
        at
com.sun.xml.bind.v2.runtime.unmarshaller.ValidatingUnmarshaller.text(ValidatingUnmarshaller.java:125)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
        at
com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.processText(StAXStreamConnector.java:334)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
        at
com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleEndElement(StAXStreamConnector.java:212)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
        at
com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:181)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
        at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:360)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
        ... 25 more
Caused by: javax.xml.bind.UnmarshalException: String "TRUE" is not valid
boolean value.
 - with linked exception:
[java.lang.IllegalArgumentException: String "TRUE" is not valid boolean
value.]
        ... 36 more
Caused by: java.lang.IllegalArgumentException: String "TRUE" is not valid
boolean value.
        at
com.sun.xml.bind.DatatypeConverterImpl._parseBoolean(DatatypeConverterImpl.java:314)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
        at
com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$13.parse(RuntimeBuiltinLeafInfoImpl.java:666)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
        at
com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$13.parse(RuntimeBuiltinLeafInfoImpl.java:669)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
        at
com.sun.xml.bind.v2.runtime.unmarshaller.TextLoader.text(TextLoader.java:65)[44:org.apache.servicemix.bundles.jaxb-impl:2.2.1.1_1]
        ... 31 more


I tried to catch the both the fault and then when that didn't work, the
global java exception just to get a result, but neither seem to catch this.

My route is 

<route id="JavelinInitiateService">
  <from uri="cxf:bean:initiateCXFConsumer" />
    <onException>
      <exception>java.lang.Exception</exception>
      <handled><constant>true</constant></handled>
      <log message="generic exception" />
     </onException>
     <onException>
      <exception>org.apache.cxf.interceptor.Fault</exception>
      <handled><constant>true</constant></handled>
      <log message="cxf fault" />
    </onException>
  <to uri="cxf:bean:initiateCXFProducer"/>
</route>

--
View this message in context: http://camel.465427.n5.nabble.com/Detecting-SOAP-Faults-tp5618665p5621045.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Detecting SOAP Faults

Posted by Castyn <er...@gmail.com>.
Ah that makes sense, thank you.

So basically I can just setup onException blocks to look for something like
org.apache.cxf.interceptor.Fault to indicate a SOAP Fault, then within that
onException block I could use a processor to do what I need?

Something like this in the processor?

SoapFault fault = exchange.getProperty(Exchange.EXCEPTION_CAUGHT,
SoapFault.class);

--
View this message in context: http://camel.465427.n5.nabble.com/Detecting-SOAP-Faults-tp5618665p5620684.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Detecting SOAP Faults

Posted by Raul Kripalani <ra...@fusesource.com>.
Hi Eric,

The Message.isFault() method is provided for backwards compatibility. Fault
messages are not used anymore in 2.x AFAIK. Instead, Exceptions are set on
the Exchange to signal errors.

Therefore, you should check Exchange.getException() != null. From what I
recall, the CXF producer sets any SOAP Fault as an Exception in the
Exchange - unless I'm mistaken...

Also, do you have any error handlers, onException blocks or doTry/doCatch
blocks? When an exception arises during routing, the route execution is
halted at the point where it failed and the error handlers are invoked.
That is to say that your processor would likely not be executed on a route
like this:

from("...")
   .to("cxf:bean:producer")   <<< sets a SOAP FAULT as an Exception
   .process(...);


Instead, the route would stop executing and the exception would be returned
immediately to the caller if you aren't doing error handling.

Check out the following for further info:
http://camel.apache.org/error-handler.html,
http://camel.apache.org/exception-clause.html,
http://camel.apache.org/try-catch-finally.html.

Regards,
Raúl.

On 4 April 2012 19:36, Castyn <er...@gmail.com> wrote:

> I currently have a custom processor setup within a route that does the
> following
>
>
> public class SoapFaultDetectionProcessor implements Processor {
>
>        public void process(Exchange exchange) throws Exception {
>                if(exchange.getIn().isFault()) {
>                        SoapFault fault =
> exchange.getIn().getBody(SoapFault.class);
>                System.out.println(fault.getMessage());
>                }
>        }
> }
>
> This processor immediately follows a CXF Producer in POJO mode.  I am
> having
> the service generate a soap fault, but for some reason the isFault() call
> always remains false.
>
> 1) Am I not using this properly or
> 2) Is there a better way to capture and manipulate / display SOAP faults
> (for logging purposes and such)
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Detecting-SOAP-Faults-tp5618665p5618665.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>