Perfect that did it. Thanks....

On 01/22/2012 06:15 AM, Claus Ibsen wrote:
Hi

The method signature of your bean is
    public String guideMe(IntegrationServiceRequest request) {

As you use the dynamic router EIP, then Camel will keep invoking this
bean, until it returns null.
So the 1st invocation is okay as the message body is a
IntegrationServiceRequest type.
However on the 2nd invocation it fails, because the message body has
changed from IntegrationServiceRequest to something else.

To remedy this make sure your method signature can handle this, such
as using Object as the type.


Or have more methods with specific types
    public String guideMe(IntegrationServiceRequest request) {
       ...
    }
    public String guideMe(IntegrationServiceResponse response) {
      ...
    }



On Sun, Jan 22, 2012 at 11:42 AM, Sudhir Swift<[email protected]>  wrote:
Hi,
Here is the setup i have

CXF Consumer ->  Dynamic Router ->  Transformer ->  CXF Producer ->  Transformer

The Consumer is a web service so i receive<REQ>....</REQ>  and have to send
<RES>...</RES>  back.

The dynamic router is looking at the content of the request and sends to a
different router. Which has a Transformer to convert the request to the
format the producer is expecting.

After i get the response from the CXF Producer, I am transforming the object
to<RES>...</RES>  type. But, i am getting a weird issue... Here are the
supporting files and the exception.

  from("cxf:bean:MyHttpConsumerEP").
  convertBodyTo(IntegrationServiceRequest.class).
        log(LoggingLevel.INFO, "${in.body.metaData.serviceName}").
        dynamicRouter(bean(IntegrationLevelRouting.class, "guideMe"));

    public String guideMe(IntegrationServiceRequest request) {
        if(request != null&&
                request.getMetaData() != null&&
                !"".equals(request.getMetaData().trim())) {
            return "direct:" + request.getMetaData().trim();
        }
        return null;
    }


from("direct:test").
beanRef("metaDataTransform", "transformIncomming").
to("cxf:bean:ThirdPartyServiceEP").
beanRef("responseTransformer", "finalStepBeforeSendingBack").
//I Convert to IntegrationServiceResponse type
log("${body}");


Here is the error i am getting



05:38:27,651 | ERROR | ault-workqueue-1 | DefaultErrorHandler              |
92 - org.apache.camel.camel-core - 2.8.3 | Failed delivery for exchangeId:
ID-hidalgo-33028-1327213718217-23-1. Exhausted after delivery attempt: 1
caught: org.apache.camel.CamelExecutionException: Exception occurred during
execution on the exchange: Exchange[Message:
com.test.ei.gateway.http.IntegrationServiceResponse@bb7207]
org.apache.camel.CamelExecutionException: Exception occurred during
execution on the exchange: Exchange[Message:
com.test.ei.gateway.http.IntegrationServiceResponse@bb7207]
    at
org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1180)[92:org.apache.camel.camel-core:2.8.3]
    at
org.apache.camel.builder.ExpressionBuilder$33.evaluate(ExpressionBuilder.java:814)[92:org.apache.camel.camel-core:2.8.3]
    at
org.apache.camel.impl.ExpressionAdapter.evaluate(ExpressionAdapter.java:36)[92:org.apache.camel.camel-core:2.8.3]
    at
org.apache.camel.component.bean.MethodInfo$2.evaluate(MethodInfo.java:371)[92:org.apache.camel.camel-core:2.8.3]
    at
org.apache.camel.component.bean.MethodInfo.createMethodInvocation(MethodInfo.java:204)[92:org.apache.camel.camel-core:2.8.3]
    at
org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:204)[92:org.apache.camel.camel-core:2.8.3]
    at
org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:151)[92:org.apache.camel.camel-core:2.8.3]
    at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:104)[92:org.apache.camel.camel-core:2.8.3]
    at
org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:74)[92:org.apache.camel.camel-core:2.8.3]
    at
org.apache.camel.language.bean.BeanExpression$InvokeProcessor.process(BeanExpression.java:162)[92:org.apache.camel.camel-core:2.8.3]
    at
org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:115)[92:org.apache.camel.camel-core:2.8.3]
    at
org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:124)[92:org.apache.camel.camel-core:2.8.3]
    at
org.apache.camel.builder.ValueBuilder.evaluate(ValueBuilder.java:41)[92:org.apache.camel.camel-core:2.8.3]
    at
org.apache.camel.processor.DynamicRouter$DynamicRoutingSlipIterator.hasNext(DynamicRouter.java:67)[92:org.apache.camel.camel-core:2.8.3]
    at
org.apache.camel.processor.RoutingSlip$2$1.done(RoutingSlip.java:282)[92:org.apache.camel.camel-core:2.8.3]
    at
org.apache.camel.management.InstrumentationProcessor$1.done(InstrumentationProcessor.java:78)[92:org.apache.camel.camel-core:2.8.3]
    at
org.apache.camel.processor.Pipeline$1.done(Pipeline.java:143)[92:org.apache.camel.camel-core:2.8.3]
    at
org.apache.camel.processor.DefaultChannel$1.done(DefaultChannel.java:317)[92:org.apache.camel.camel-core:2.8.3]
    at
org.apache.camel.processor.RedeliveryErrorHandler$1.done(RedeliveryErrorHandler.java:330)[92:org.apache.camel.camel-core:2.8.3]
    at
org.apache.camel.management.InstrumentationProcessor$1.done(InstrumentationProcessor.java:78)[92:org.apache.camel.camel-core:2.8.3]
    at
org.apache.camel.impl.ProducerCache$1.done(ProducerCache.java:307)[92:org.apache.camel.camel-core:2.8.3]
    at
org.apache.camel.processor.SendProcessor$2$1.done(SendProcessor.java:119)[92:org.apache.camel.camel-core:2.8.3]
    at
org.apache.camel.component.cxf.CxfClientCallback.handleResponse(CxfClientCallback.java:62)[152:org.apache.camel.camel-cxf:2.8.3]
    at
org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:818)[138:org.apache.cxf.bundle:2.4.4]
    at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1626)[138:org.apache.cxf.bundle:2.4.4]
    at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream$1.run(HTTPConduit.java:1498)[138:org.apache.cxf.bundle:2.4.4]
    at
org.apache.cxf.workqueue.AutomaticWorkQueueImpl$2.run(AutomaticWorkQueueImpl.java:353)[138:org.apache.cxf.bundle:2.4.4]
    at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_30]
    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_30]
    at java.lang.Thread.run(Thread.java:662)[:1.6.0_30]
Caused by: org.apache.camel.InvalidPayloadException: No body available of
type: com.test.ei.gateway.http.IntegrationServiceRequest but has value:
com.test.ei.gateway.http.IntegrationServiceResponse@bb7207 of type:
com.test.ei.gateway.http.IntegrationServiceResponse on: Message:
com.test.ei.gateway.http.IntegrationServiceResponse@bb7207. Caused by: No
type converter available to convert from type:
com.test.ei.gateway.http.IntegrationServiceResponse to the required type:
com.test.ei.gateway.http.IntegrationServiceRequest with value
com.test.ei.gateway.http.IntegrationServiceResponse@bb7207.
Exchange[Message:
com.test.ei.gateway.http.IntegrationServiceResponse@bb7207]. Caused by:
[org.apache.camel.NoTypeConversionAvailableException - No type converter
available to convert from type:
com.test.ei.gateway.http.IntegrationServiceResponse to the required type:
com.test.ei.gateway.http.IntegrationServiceRequest with value
com.test.ei.gateway.http.IntegrationServiceResponse@bb7207]
    at
org.apache.camel.impl.MessageSupport.getMandatoryBody(MessageSupport.java:102)[92:org.apache.camel.camel-core:2.8.3]
    at
org.apache.camel.builder.ExpressionBuilder$33.evaluate(ExpressionBuilder.java:812)[92:org.apache.camel.camel-core:2.8.3]
    ... 28 more
Caused by: org.apache.camel.NoTypeConversionAvailableException: No type
converter available to convert from type:
com.test.ei.gateway.http.IntegrationServiceResponse to the required type:
com.test.ei.gateway.http.IntegrationServiceRequest with value
com.test.ei.gateway.http.IntegrationServiceResponse@bb7207
    at
org.apache.camel.impl.converter.BaseTypeConverterRegistry.mandatoryConvertTo(BaseTypeConverterRegistry.java:144)[92:org.apache.camel.camel-core:2.8.3]
    at
org.apache.camel.core.osgi.OsgiTypeConverter.mandatoryConvertTo(OsgiTypeConverter.java:110)[153:org.apache.camel.camel-blueprint:2.8.3]
    at
org.apache.camel.impl.MessageSupport.getMandatoryBody(MessageSupport.java:100)[92:org.apache.camel.camel-core:2.8.3]
    ... 29 more

Any advice????

Thanks,
Sudhir




Reply via email to