Hi, Here is my servicemix.xml, and I have pasted my router bean in preciously post.
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:sm="http://servicemix.apache.org/config/1.0" xmlns:cxfse="http://servicemix.apache.org/cxfse/1.0" xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0" xmlns:bean="http://servicemix.apache.org/bean/1.0" xmlns:camel="http://activemq.apache.org/camel/schema/spring" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bill="http://mm.service.integration.symphony" xsi:schemaLocation="http://www.springframework.org/schema/beansclasspath:xmlschema/spring-beans-2.5.xsd http://servicemix.apache.org/config/1.0classpath:xmlschema/servicemix.xsd http://servicemix.apache.org/cxfse/1.0classpath:xmlschema/servicemix-cxf-se.xsd http://servicemix.apache.org/cxfbc/1.0classpath:xmlschema/servicemix-cxf-bc.xsd http://servicemix.apache.org/bean/1.0classpath:xmlschema/servicemix-bean.xsd http://activemq.apache.org/camel/schema/springclasspath:xmlschema/camel-spring.xsd"> <sm:container id="jbiContainer" embedded="true"> <sm:activationSpecs> <sm:activationSpec id="servicemix-camel" service="bill:BillingServiceCamelRouter" endpoint="BillingServicePort"> <sm:component> <ref bean="jbi" /> </sm:component> </sm:activationSpec> </sm:activationSpecs> <sm:endpoints> <cxfse:endpoint id="BillingService" useJBIWrapper="false"> <cxfse:inFaultInterceptors> <bean class="org.apache.cxf.interceptor.LoggingInInterceptor" /> </cxfse:inFaultInterceptors> <cxfse:inInterceptors> <bean class="org.apache.cxf.interceptor.LoggingInInterceptor" /> </cxfse:inInterceptors> <cxfse:outFaultInterceptors> <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor" /> </cxfse:outFaultInterceptors> <cxfse:outInterceptors> <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor" /> </cxfse:outInterceptors> <cxfse:pojo> <bean class="symphony.integration.service.mm.LppBillingServiceImpl" /> </cxfse:pojo> </cxfse:endpoint> <cxfbc:consumer wsdl="classpath:symphony/integration/service/mm/BillingService.wsdl" interfaceName="symphony.integration.service.mm.BillingService" targetEndpoint="BillingServicePort" targetService="bill:BillingServiceCamelRouter" useJBIWrapper="false"> <cxfbc:inFaultInterceptors> <bean class="org.apache.cxf.interceptor.LoggingInInterceptor" /> </cxfbc:inFaultInterceptors> <cxfbc:inInterceptors> <bean class="org.apache.cxf.interceptor.LoggingInInterceptor" /> </cxfbc:inInterceptors> <cxfbc:outFaultInterceptors> <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor" /> </cxfbc:outFaultInterceptors> <cxfbc:outInterceptors> <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor" /> </cxfbc:outInterceptors> </cxfbc:consumer> </sm:endpoints> </sm:container> <bean id="jbi" class="org.apache.servicemix.camel.CamelJbiComponent" /> <bean id="router" class="symphony.integration.service.mm.BillingServiceRouter" /> <camelContext id="camelContext" useJmx="true" xmlns="http://activemq.apache.org/camel/schema/spring"> <route> <from uri="jbi:endpoint: http://mm.service.integration.symphony/BillingServiceCamelRouter/BillingServicePort" /> <recipientList> <methodCall bean="router" method="route"/> </recipientList> </route> </camelContext> </beans> Jackey 2008/11/20 Willem Jiang <[EMAIL PROTECTED]> > Can you show us your DSL ? > I can't image how this string can be turned into a Source Object, may be > you just put the recipientlist into the message body instead of setting > it into the message header. > > Willem > > Jackey Ding wrote: > > Hi, > > > > I traced error, the real serivce provider is return the correct message > to > > camel, but camel not pass the message to the client. > > The exception is thrown at method DefaultTypeConverter.convertTo(Class<T> > > type, Exchange exchange, Object value); because it could not find > suitable > > conversion. Here is the paramter value: > > > > type Class<T> (javax.xml.transform.Source) (id=90) > > > > exchange JbiExchange (id=91) > > binding JbiBinding (id=97) > > context SpringCamelContext (id=100) > > exception null > > exchangeId null > > fault null > > in JbiMessage (id=113) > > messageExchange InOutImpl (id=114) > > out JbiMessage (id=99) > > pattern ExchangePattern (id=116) > > properties ConcurrentHashMap<K,V> (id=118) > > unitOfWork DefaultUnitOfWork (id=121) > > > > value [0] "jbi:endpoint: > > http://mm.service.integration.symphony/BillingService/BillingServicePort > " > > > > > > jackey > > > > 2008/11/20 Jackey Ding <[EMAIL PROTECTED]> > > > >> BTW, I find the route method was executed 6 times. > >> > >> Jackey > >> > >> 2008/11/20 Jackey Ding <[EMAIL PROTECTED]> > >> > >> Hi, > >>> I tried code you pasted, here is the message. > >>> > >>> 2008-11-20 19:53:48 org.apache.cxf.interceptor.LoggingInInterceptor > >>> logging > >>> infor: Inbound Message > >>> ---------------------------- > >>> Encoding: > >>> Headers: > >>> Messages: > >>> Message: > >>> > >>> Payload: <?xml version="1.0" encoding="UTF-8"?><soap:Envelope > xmlns:soap=" > >>> http://schemas.xmlsoap.org/soap/envelope/ > "><soap:Body><ns1:getBillingCount > >>> xmlns:ns1="http://mm.service.integration.symphony"><arg0 > >>> xmlns=""><beginRowIndex xmlns="">0</beginRowIndex><entityPage > >>> xmlns=""><beginRowIndex xmlns="">0</beginRowIndex><rowSize > >>> xmlns="">10</rowSize></entityPage><rowSize > xmlns="">10</rowSize><billingNo > >>> > xmlns="">KP0000000005</billingNo></arg0></ns1:getBillingCount></soap:Body></soap:Envelope> > >>> -------------------------------------- > >>> 2008-11-20 19:53:48 > >>> org.apache.cxf.interceptor.LoggingOutInterceptor$LoggingCallback > onClose > >>> info: Outbound Message > >>> --------------------------- > >>> Encoding: UTF-8 > >>> Headers: > >>> Messages: > >>> Payload: <soap:Envelope xmlns:soap=" > >>> http://schemas.xmlsoap.org/soap/envelope/ > "><soap:Body><ns1:getBillingCountResponse > >>> xmlns:ns1="http://mm.service.integration.symphony > >>> > "><return>1</return></ns1:getBillingCountResponse></soap:Body></soap:Envelope> > >>> -------------------------------------- > >>> 2008-11-20 19:53:48 org.apache.camel.processor.Logger log > >>> error: Failed delivery for exchangeId: > >>> ID-mycomputer/1988-1227182024906/0-0. On delivery attempt: 0 caught: > >>> org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed > to > >>> invoke method: route on router due to: > >>> org.apache.camel.NoTypeConversionAvailableException: No type converter > >>> available to convert from type: class [Ljava.lang.String; to the > required > >>> type: javax.xml.transform.Source with value [Ljava.lang.String;@e8709d > >>> org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed > to > >>> invoke method: route on router due to: > >>> org.apache.camel.NoTypeConversionAvailableException: No type converter > >>> available to convert from type: class [Ljava.lang.String; to the > required > >>> type: javax.xml.transform.Source with value [Ljava.lang.String;@e8709d > >>> at > >>> > org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:79) > >>> at > >>> org.apache.camel.processor.RecipientList.process(RecipientList.java:58) > >>> at > >>> > org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:75) > >>> at > >>> > org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:172) > >>> at > >>> > org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:93) > >>> at > >>> > org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:63) > >>> at > >>> > org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:47) > >>> at > >>> > org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:41) > >>> at > >>> > org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:66) > >>> at > >>> > org.apache.servicemix.camel.CamelProviderEndpoint.handleActiveProviderExchange(CamelProviderEndpoint.java:115) > >>> at > >>> > org.apache.servicemix.camel.CamelProviderEndpoint.process(CamelProviderEndpoint.java:73) > >>> at > >>> > org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:600) > >>> at > >>> > org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:554) > >>> at > >>> > org.apache.servicemix.common.AsyncBaseLifeCycle.onMessageExchange(AsyncBaseLifeCycle.java:510) > >>> at > >>> > org.apache.servicemix.common.SyncLifeCycleWrapper.onMessageExchange(SyncLifeCycleWrapper.java:60) > >>> at > >>> > org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:620) > >>> at > >>> > org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172) > >>> at > >>> > org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:168) > >>> at > >>> > org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134) > >>> at > >>> > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650) > >>> at > >>> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675) > >>> at java.lang.Thread.run(Thread.java:595) > >>> Caused by: org.apache.camel.NoTypeConversionAvailableException: No type > >>> converter available to convert from type: class [Ljava.lang.String; to > the > >>> required type: javax.xml.transform.Source with value > >>> [Ljava.lang.String;@e8709d > >>> at > >>> > org.apache.camel.impl.converter.DefaultTypeConverter.convertTo(DefaultTypeConverter.java:117) > >>> at > >>> > org.apache.camel.util.ExchangeHelper.convertToType(ExchangeHelper.java:180) > >>> at > >>> > org.apache.servicemix.camel.JbiBinding.convertBodyToJbi(JbiBinding.java:61) > >>> at > org.apache.servicemix.camel.JbiMessage.setBody(JbiMessage.java:159) > >>> at > >>> > org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:125) > >>> at > >>> > org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:76) > >>> ... 21 more > >>> [EMAIL PROTECTED] > >>> > >>> The message in red is system printout. > >>> > >>> BTW, I am using camel 1.5.0. > >>> > >>> > >>> Jackey > >>> > >>> 2008/11/20 Claus Ibsen <[EMAIL PROTECTED]> > >>> > >>>> Hi Try with this > >>>> > >>>>> @RecipientList > >>>>> public String[] route(Exchange exchange) { > >>>>> System.out.println(exchange.getIn().getBody()); > >>>>> return new String[]{"jbi:endpoint: > >>>>> > >>>> > http://mm.service.integration.symphony/BillingService/BillingServicePort > >>>> "}; > >>>>> } > >>>> > >>>> /Claus Ibsen > >>>> Apache Camel Committer > >>>> Blog: http://davsclaus.blogspot.com/ > >>>> > >>>> > >>>> > >>>> On Thu, Nov 20, 2008 at 9:34 AM, Jackey Ding <[EMAIL PROTECTED]> > >>>> wrote: > >>>>> Hi, > >>>>> > >>>>> Here is my bean. > >>>>> > >>>>> public class BillingServiceRouter{ > >>>>> > >>>>> @RecipientList > >>>>> public String[] route(String body) { > >>>>> System.out.println(body); > >>>>> return new String[]{"jbi:endpoint: > >>>>> > >>>> > http://mm.service.integration.symphony/BillingService/BillingServicePort > >>>> "}; > >>>>> } > >>>>> } > >>>>> > >>>>> Jackey > >>>>> > >>>>> 2008/11/20 Claus Ibsen <[EMAIL PROTECTED]> > >>>>> > >>>>>> Hi > >>>>>> > >>>>>> What does your bean look like? > >>>>>>> <methodCall bean="router" method="route"/> > >>>>>> I think the issue is that the payload from servicemix is XML and > Camel > >>>>>> will try to find coerce the payload to the type you have defined in > >>>>>> your bean. > >>>>>> > >>>>>> So you can change the signature to use Exchange as type then there > >>>>>> shouldn't take any type conventions place. > >>>>>> > >>>>>> > >>>>>> > >>>>>> /Claus Ibsen > >>>>>> Apache Camel Committer > >>>>>> Blog: http://davsclaus.blogspot.com/ > >>>>>> > >>>>>> > >>>>>> > >>>>>> On Thu, Nov 20, 2008 at 9:11 AM, Jackey Ding <[EMAIL PROTECTED] > > > >>>>>> wrote: > >>>>>>> Hi, > >>>>>>> > >>>>>>> I want to wirte a bean dynamically determine what endpoints will be > >>>>>> invoked > >>>>>>> when a service is called. It seems that dynamic recipientlist can > >>>> meet my > >>>>>>> demand. I wrote a simple method just return a string as endpoint > >>>> name, > >>>>>> and > >>>>>>> got the error message as below: > >>>>>>> > >>>>>>> info: Outbound Message > >>>>>>> --------------------------- > >>>>>>> Encoding: UTF-8 > >>>>>>> Headers: > >>>>>>> Messages: > >>>>>>> Payload: <soap:Envelope xmlns:soap=" > >>>>>>> http://schemas.xmlsoap.org/soap/envelope/ > >>>>>> "><soap:Body><ns1:getBillingCountResponse > >>>>>>> xmlns:ns1="http://mm.service.integration.symphony > >>>>>>> > >>>> > "><return>1</return></ns1:getBillingCountResponse></soap:Body></soap:Envelope> > >>>>>>> -------------------------------------- > >>>>>>> 2008-11-20 15:36:36 org.apache.camel.processor.Logger log > >>>>>>> error: Failed delivery for exchangeId: > >>>>>> ID-mycomputer/3353-1227166593020/0-0. > >>>>>>> On delivery attempt: 0 caught: > >>>>>>> org.apache.camel.language.bean.RuntimeBeanExpressionException: > >>>> Failed to > >>>>>>> invoke method: route on router due to: > >>>>>>> org.apache.camel.NoTypeConversionAvailableException: No type > >>>> converter > >>>>>>> available to convert from type: class [Ljava.lang.String; to the > >>>> required > >>>>>>> type: javax.xml.transform.Source with value > >>>> [Ljava.lang.String;@1f3329a > >>>>>>> org.apache.camel.language.bean.RuntimeBeanExpressionException: > >>>> Failed to > >>>>>>> invoke method: route on router due to: > >>>>>>> org.apache.camel.NoTypeConversionAvailableException: No type > >>>> converter > >>>>>>> available to convert from type: class [Ljava.lang.String; to the > >>>> required > >>>>>>> type: javax.xml.transform.Source with value > >>>> [Ljava.lang.String;@1f3329a > >>>>>>> at > >>>>>>> > >>>> > org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:79) > >>>>>>> at > >>>>>>> > >>>> > org.apache.camel.processor.RecipientList.process(RecipientList.java:58) > >>>>>>> at > >>>>>>> > >>>> > org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:75) > >>>>>>> at > >>>>>>> > >>>> > org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:172) > >>>>>>> at > >>>>>>> > >>>> > org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:93) > >>>>>>> at > >>>>>>> > >>>> > org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:63) > >>>>>>> at > >>>>>>> > >>>> > org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:47) > >>>>>>> at > >>>>>>> > >>>> > org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:41) > >>>>>>> at > >>>>>>> > >>>> > org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:66) > >>>>>>> at > >>>>>>> > >>>> > org.apache.servicemix.camel.CamelProviderEndpoint.handleActiveProviderExchange(CamelProviderEndpoint.java:115) > >>>>>>> at > >>>>>>> > >>>> > org.apache.servicemix.camel.CamelProviderEndpoint.process(CamelProviderEndpoint.java:73) > >>>>>>> at > >>>>>>> > >>>> > org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:600) > >>>>>>> at > >>>>>>> > >>>> > org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:554) > >>>>>>> at > >>>>>>> > >>>> > org.apache.servicemix.common.AsyncBaseLifeCycle.onMessageExchange(AsyncBaseLifeCycle.java:510) > >>>>>>> at > >>>>>>> > >>>> > org.apache.servicemix.common.SyncLifeCycleWrapper.onMessageExchange(SyncLifeCycleWrapper.java:60) > >>>>>>> at > >>>>>>> > >>>> > org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:620) > >>>>>>> at > >>>>>>> > >>>> > org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172) > >>>>>>> at > >>>>>>> > >>>> > org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:168) > >>>>>>> at > >>>>>>> > >>>> > org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134) > >>>>>>> at > >>>>>>> > >>>> > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650) > >>>>>>> at > >>>>>>> > >>>> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675) > >>>>>>> at java.lang.Thread.run(Thread.java:595) > >>>>>>> Caused by: org.apache.camel.NoTypeConversionAvailableException: No > >>>> type > >>>>>>> converter available to convert from type: class [Ljava.lang.String; > >>>> to > >>>>>> the > >>>>>>> required type: javax.xml.transform.Source with value > >>>>>>> [Ljava.lang.String;@1f3329a > >>>>>>> at > >>>>>>> > >>>> > org.apache.camel.impl.converter.DefaultTypeConverter.convertTo(DefaultTypeConverter.java:117) > >>>>>>> at > >>>>>>> > >>>> > org.apache.camel.util.ExchangeHelper.convertToType(ExchangeHelper.java:180) > >>>>>>> at > >>>>>>> > >>>> > org.apache.servicemix.camel.JbiBinding.convertBodyToJbi(JbiBinding.java:61) > >>>>>>> at > >>>> org.apache.servicemix.camel.JbiMessage.setBody(JbiMessage.java:159) > >>>>>>> at > >>>>>>> > >>>> > org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:125) > >>>>>>> at > >>>>>>> > >>>> > org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:76) > >>>>>>> ... 21 more > >>>>>>> > >>>>>>> > >>>>>>> my configuration is > >>>>>>> <bean id="router" > >>>>>>> class="symphony.integration.service.mm.BillingServiceRouter" > >>>> /> > >>>>>>> <camelContext id="camelContext" useJmx="true" > >>>>>>> xmlns="http://activemq.apache.org/camel/schema/spring"> > >>>>>>> <route> > >>>>>>> <from > >>>>>>> uri="jbi:endpoint: > >>>>>>> > >>>> > http://mm.service.integration.symphony/BillingServiceCamelRouter/BillingServicePort > >>>>>> " > >>>>>>> /> > >>>>>>> <recipientList> > >>>>>>> <methodCall bean="router" method="route"/> > >>>>>>> </recipientList> > >>>>>>> </route> > >>>>>>> </camelContext> > >>>>>>> > >>>>>>> my bean, just return a string. > >>>>>>> @RecipientList > >>>>>>> public String[] route(String body) { > >>>>>>> return new String[]{"jbi:endpoint: > >>>>>>> > >>>> > http://mm.service.integration.symphony/BillingService/BillingServicePort > >>>>>> "}; > >>>>>>> } > >>>>>>> > >>>>>>> It's weird, when change config to point-to-point mode it works > fine. > >>>>>>> <route> > >>>>>>> <from > >>>>>>> uri="jbi:endpoint: > >>>>>>> > >>>> > http://mm.service.integration.symphony/BillingServiceCamelRouter/BillingServicePort > >>>>>> " > >>>>>>> /> > >>>>>>> <to > >>>>>>> uri="jbi:endpoint: > >>>>>>> > >>>> > http://mm.service.integration.symphony/BillingService/BillingServicePort > >>>> " > >>>>>> /> > >>>>>>> </route> > >>>>>>> > >>>>>>> Thanks & best regards > >>>>>>> > >>> > > > >
