2 Replies Latest reply on Sep 25, 2010 7:25 PM by Lowry Curry

    trouble with camel route from cxf consumer to cxf producer

    Lowry Curry Newbie

      I am trying to implement a camel route that simply acts as a web service proxy (intermediary), i.e.

      1) cxf consumer endpoint receives a SOAP/HTTP request from an external client and forwards to cxf producer endpoint.

      2) cxf producer sends SOAP/HTTP request to an external service

      3) response gets propogated back to original external web service client

       

      I am using a very simple hello_world WSDL. When i invoke the route i think step 3) is causing a problem (the marshalling of response).

       

      Attached find demo for CXF Camel route that uses CXF Consumer endpoint to receive web servce calls and forwards them to CXF Provider endpoint that calls external web service. The response I?m getting back from Camel contains ?Couldn't parse stream? (see below for full exception)?

       

      I've attached a simple example that shows the problem. I use SOAP UI to invoke route and SOAP UI mock web service to simulate external web service (server.)

      The spring config is in:

      src\main\resources\META-INF\spring\CamelCXFProviderRouteConfig.xml

       

      The route is simple :

       

          

       

      You can either run via 'mvn camel:run' or deploy as an osgi bundle.

       

      You should then be able to access the WSDL here:

      http://localhost:9000/GreeterContext/SOAPMessageService?WSDL

       

      The route is configured to target the destination (external) endpoint at the following URL:

      http://localhost:9001/GreeterContext/SOAPMessageService

      So, the above web service target needs to be running (via SOAP UI or some other server simulator.)

       

      Please help!

      Thanks,

      -Lowry

       

      FULL ERROR

      =========

      09:04:17,718 | WARN  | 3@qtp-12068308-2 | PhaseInterceptorChain            | ache.cxf.common.logging.LogUtils  365 | Intercep

      tor for SOAPService#greetMe has thrown exce

      ption, unwinding now

      org.apache.cxf.interceptor.Fault: Couldn't parse stream.

              at org.apache.camel.component.cxf.CxfConsumer$1.invoke(CxfConsumer.java:101)

              at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)

              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)

              at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

              at java.util.concurrent.FutureTask.run(FutureTask.java:138)

              at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)

              at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106)

              at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)

              at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:110)

              at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:312)

              at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:276)

              at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70)

              at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)

              at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)

              at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)

              at org.mortbay.jetty.Server.handle(Server.java:326)

              at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)

              at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:938)

              at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)

              at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)

              at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)

              at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)

              at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

      Caused by: java.lang.RuntimeException: Couldn't parse stream.

              at org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:1052)

              at org.apache.cxf.interceptor.StaxInInterceptor.handleMessage(StaxInInterceptor.java:104)

              at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)

              at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:700)

              at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2261)

              at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2134)

              at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1988)

              at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)

              at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:639)

              at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInte

      rceptor.java:62)

              at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)

              at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:487)

              at org.apache.camel.component.cxf.CxfProducer.process(CxfProducer.java:146)

              at org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:97)

              at org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:95)

              at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:146)

              at org.apache.camel.processor.SendProcessor.doProcess(SendProcessor.java:94)

              at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:82)

              at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)

              at org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)

              at org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)

              at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:93)

              at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)

              at org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:177)

              at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:143)

              at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:88)

              at org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)

              at org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:228)

              at org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:66)

              at org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)

              at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)

              at org.apache.camel.component.cxf.CxfConsumer$1.invoke(CxfConsumer.java:91)

              ... 22 more

      Caused by: com.ctc.wstx.exc.WstxIOException: Invalid UTF-8 start byte 0x8b (at char #2, byte #-1)

              at com.ctc.wstx.stax.WstxInputFactory.doCreateSR(WstxInputFactory.java:536)

              at com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:585)

              at com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:610)

              at com.ctc.wstx.stax.WstxInputFactory.createXMLStreamReader(WstxInputFactory.java:316)

              at org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:1050)

              ... 53 more

      Caused by: java.io.CharConversionException: Invalid UTF-8 start byte 0x8b (at char #2, byte #-1)

              at com.ctc.wstx.io.UTF8Reader.reportInvalidInitial(UTF8Reader.java:303)

              at com.ctc.wstx.io.UTF8Reader.read(UTF8Reader.java:189)

              at com.ctc.wstx.io.ReaderBootstrapper.initialLoad(ReaderBootstrapper.java:250)

              at com.ctc.wstx.io.ReaderBootstrapper.bootstrapInput(ReaderBootstrapper.java:133)

              at com.ctc.wstx.stax.WstxInputFactory.doCreateSR(WstxInputFactory.java:531)

              ... 57 more