Hi, I did what you advised me. I activated the soap envelope and used xslt to do the message transformation. But I'm still doing something wrong because now I get this exception when I call it.
09:51:03,431 | INFO | x-camel-thread-4 | route4 | rg.apache.camel.processor.Logger 212 | ************ TO ADD
09:51:03,433 | INFO | x-camel-thread-4 | route2plus-xslt | rg.apache.camel.processor.Logger 88 | Exchange
09:51:03,435 | ERROR | -cxf-bc-thread-3 | CxfBcComponent | icemix.common.AsyncBaseLifeCycle 480 | Error processing exchange org.apache.servicemix.jbi.runtime.impl.InOutImpl@7210ec
java.lang.NullPointerException
at org.apache.servicemix.cxfbc.CxfBcProvider.process(CxfBcProvider.java:206)
at org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:627)
at org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:581)
at org.apache.servicemix.common.AsyncBaseLifeCycle.processExchangeInTx(AsyncBaseLifeCycle.java:478)
at org.apache.servicemix.common.AsyncBaseLifeCycle$2.run(AsyncBaseLifeCycle.java:347)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)
at java.lang.Thread.run(Thread.java:595)
09:51:03,436 | ERROR | x-camel-thread-4 | DefaultErrorHandler | rg.apache.camel.processor.Logger 248 | Failed delivery for exchangeId: 350d178e-77b9-48a4-a360-fd2989d3a1be. Exhausted after delivery attempt: 1 caught: java.lang.NullPointerException
java.lang.NullPointerException
at org.apache.servicemix.cxfbc.CxfBcProvider.process(CxfBcProvider.java:206)
at org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:627)
at org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:581)
at org.apache.servicemix.common.AsyncBaseLifeCycle.processExchangeInTx(AsyncBaseLifeCycle.java:478)
at org.apache.servicemix.common.AsyncBaseLifeCycle$2.run(AsyncBaseLifeCycle.java:347)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)
at java.lang.Thread.run(Thread.java:595)
09:51:03,440 | WARN | 99@qtp-1930252-1 | PhaseInterceptorChain | ache.cxf.common.logging.LogUtils 361 | Interceptor for {http://routing.examples.andago.com}routingExampleService#{http://routing.examples.andago.com}routing has thrown exception, unwinding now
java.lang.NullPointerException
at org.apache.servicemix.cxfbc.CxfBcConsumer$JbiPostInvokerInterceptor.handleMessage(CxfBcConsumer.java:859)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:109)
at org.apache.servicemix.cxfbc.CxfBcConsumer$JbiChainInitiationObserver.onMessage(CxfBcConsumer.java:675)
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.HandlerList.handle(HandlerList.java:49)
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)
My cxf consumer configuration:
<cxfbc:consumer wsdl="classpath:wsdl/RoutingExampleService.wsdl"
targetService="routing:RoutingRouterService"
targetEndpoint="RoutingRouterEndpoint"
useJBIWrapper="false"
useSOAPEnvelope="true"/>
My router configuration:
<osgi:camelContext id="router" xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="jbi:endpoint:http://routing.examples.andago.com/RoutingRouterService/RoutingRouterEndpoint" />
<choice>
<when>
<xpath>//xsd:operation = '0'</xpath>
<log message="************ TO ADD"/>
<to uri="xslt:xsl/route2plus.xsl"/>
<to uri="log:route2plus-xslt"/>
<to uri="jbi:service:http://toplus.examples.andago.com/ToPlus-Service" />
</when>
<when>
<xpath>//xsd:operation = '1'</xpath>
<log message="********* TO MULTIPLY"/>
<to uri="xslt:xsl/route2multiply.xsl"/>
<to uri="log:route2multiply-xslt"/>
<to uri="jbi:service:http://tomultiply.examples.andago.com/ToMultiply-Service" />
</when>
</choice>
</route>
</osgi:camelContext>
And my provider configuration:
<cxfbc:provider wsdl="classpath:wsdl/ToPlus-Service.wsdl"
locationURI="http://localhost:8888/axis2/services/ToPlus-Service"
service="toplus:ToPlus-Service"
endpoint="ServiceHttpSoap11Endpoint"
interfaceName="toplus:ToPlus-ServicePortType"
useJBIWrapper="false"
useSOAPEnvelope="true"/>
As you can see at the begining (the exception), the call is routed "TO ADD" service but after that I dont know if the message body is correct. Should the body be the whole message or is that part correct? I mean the cxf-consumer soap message is:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rout="http://routing.examples.andago.com" xmlns:xsd="http://beans.io.examples.andago.com/xsd">
<soapenv:Header/>
<soapenv:Body>
<rout:routingExampleIn>
<rout:opInfo>
<xsd:operation>0</xsd:operation>
<xsd:op1>2</xsd:op1>
<xsd:op2>5</xsd:op2>
</rout:opInfo>
</rout:routingExampleIn>
</soapenv:Body>
</soapenv:Envelope>
And the soap message that expects the final web service is:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:top="http://toplus.examples.andago.com">
<soapenv:Header/>
<soapenv:Body>
<top:toPlus>
<top:p1>2</top:p1>
<top:p2>5</top:p2>
</top:toPlus>
</soapenv:Body>
</soapenv:Envelope>
And you can see in the exception stacktrace:
Exchange[BodyType:String, Body:<?xml version="1.0" encoding="UTF-8"?><soap ...
Is that what the cxf-provider is waiting for?
Regards & Thx again.
Edited by: fsalceda on Apr 30, 2010 8:21 AM