camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raul Kripalani <r...@fusesource.com>
Subject Re: Detecting SOAP Faults
Date Thu, 05 Apr 2012 21:21:20 GMT
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 <eric.bender@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.

Mime
View raw message