You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Nick Heudecker <nh...@gmail.com> on 2009/02/14 03:17:22 UTC

Null response calling route

Hi,

I'm using camel 2.0 snapshot and trying to get a response back from the
first condition in the following choice():

        from(JMS_JIS)
            .choice()
                .when().xpath("/jis:ListSupportedFeaturesRequest",
cisNamespace)
                    .unmarshal("camelJaxbDataFormat")
                    .setHeader("responsetype", constant(new
ListFeaturesResponseType()))
                    .to(ExchangePattern.InOut,
"filter:cisListSupportedFeaturesFilterChain")
                .when().xpath("/jis:ContentQueryRequest", cisNamespace)
                    .unmarshal("camelJaxbDataFormat")
                    .setHeader("responsetype", constant(new
ContentQueryResponseType()))
                    .to(ExchangePattern.InOut,
"filter:cisContentQueryRequestFilterChain")
                .otherwise()
                    .unmarshal("camelJaxbDataFormat")
                    .setHeader("responsetype", constant(new
ServiceCheckResponseType()))
                    .to(ExchangePattern.InOut,
"filter:serviceCheckFilterChain")
                .end();

The "filter" component is one I created.  I can see that the result object
is being set at the end of my FilterProcessor, but the response returned
from:

Object response = producerTemplate.sendBody(CamelRoutes.JMS_JIS,
ExchangePattern.InOut, xmlRequestBody);

is null.  "xmlRequestBody" is just an XML string.  As far as I can tell,
everything is working fine except for getting back the result object.
Interestingly, if I change the sendBody(...) call to:

Object response = producerTemplate.sendBody(CamelRoutes.JMS_JIS,
xmlRequestBody);

I get the original XML returned as the response object.  I'm not sure what
that indicates, but it's not what I need to have happen.

There is nothing in the logs to indicate an error in from the JMS or JAXB
components.

I've been beating my head against this for a few hours and I don't know what
else I could try.  Any help is very much appreciated.  Thanks for your
time.

Regards,
Nick

Re: Null response calling route

Posted by Claus Ibsen <cl...@gmail.com>.
On Sat, Feb 14, 2009 at 7:10 PM, Nick Heudecker <nh...@gmail.com> wrote:
> Yes, I'm sure the destination receives the message.  The message body is
> processed and the response set on the message out.
>
> I've tried it with the direct: component and get the same result.  I've set
> the InOut pattern everywhere I can see to set it and I'm not getting a
> response body.
You can create a sample project with your problem and .zip it and then
I can check it out.

You can also try the send(endpoint, exchange) method (not the
sendBody), as you will have the full power
of the response and can check the exchange in or out body if you
response is there. There could be an issue in the
code in producer template that automatically extracts the body to
return it. Well at least debugging will help.



>
> I don't see enrich() in my current snapshot.  When was it introduced in
> 2.0?
Just recently, like a few days ago.

>
> Thanks for your help.
>
>
> On Sat, Feb 14, 2009 at 1:34 AM, Claus Ibsen <cl...@gmail.com> wrote:
>
>> Hi
>>
>> If you want to do a request-response with JMS you need to use InOut.
>>
>> You can use the requestBody method instead as its based on InOut.
>>
>> Are you sure the destination receives the JMS message? And that it
>> returns a reply?
>>
>> Have you tried with some other transport than JMS, you can eg try a
>> direct:foo and just produce a result manually in Camel to simulate the
>> JMS stuff, to ensure the other parts is working okay. So its only the
>> JMS reqeust-reply that is not working.
>>
>> BTW: We just recently added a new DSL enrich() for the content
>> enricher EIP pattern:
>> http://camel.apache.org/content-enricher.html
>>
>>
>>
>>
>> On Sat, Feb 14, 2009 at 3:17 AM, Nick Heudecker <nh...@gmail.com>
>> wrote:
>> > Hi,
>> >
>> > I'm using camel 2.0 snapshot and trying to get a response back from the
>> > first condition in the following choice():
>> >
>> >        from(JMS_JIS)
>> >            .choice()
>> >                .when().xpath("/jis:ListSupportedFeaturesRequest",
>> > cisNamespace)
>> >                    .unmarshal("camelJaxbDataFormat")
>> >                    .setHeader("responsetype", constant(new
>> > ListFeaturesResponseType()))
>> >                    .to(ExchangePattern.InOut,
>> > "filter:cisListSupportedFeaturesFilterChain")
>> >                .when().xpath("/jis:ContentQueryRequest", cisNamespace)
>> >                    .unmarshal("camelJaxbDataFormat")
>> >                    .setHeader("responsetype", constant(new
>> > ContentQueryResponseType()))
>> >                    .to(ExchangePattern.InOut,
>> > "filter:cisContentQueryRequestFilterChain")
>> >                .otherwise()
>> >                    .unmarshal("camelJaxbDataFormat")
>> >                    .setHeader("responsetype", constant(new
>> > ServiceCheckResponseType()))
>> >                    .to(ExchangePattern.InOut,
>> > "filter:serviceCheckFilterChain")
>> >                .end();
>> >
>> > The "filter" component is one I created.  I can see that the result
>> object
>> > is being set at the end of my FilterProcessor, but the response returned
>> > from:
>> >
>> > Object response = producerTemplate.sendBody(CamelRoutes.JMS_JIS,
>> > ExchangePattern.InOut, xmlRequestBody);
>> >
>> > is null.  "xmlRequestBody" is just an XML string.  As far as I can tell,
>> > everything is working fine except for getting back the result object.
>> > Interestingly, if I change the sendBody(...) call to:
>> >
>> > Object response = producerTemplate.sendBody(CamelRoutes.JMS_JIS,
>> > xmlRequestBody);
>> >
>> > I get the original XML returned as the response object.  I'm not sure
>> what
>> > that indicates, but it's not what I need to have happen.
>> >
>> > There is nothing in the logs to indicate an error in from the JMS or JAXB
>> > components.
>> >
>> > I've been beating my head against this for a few hours and I don't know
>> what
>> > else I could try.  Any help is very much appreciated.  Thanks for your
>> > time.
>> >
>> > Regards,
>> > Nick
>> >
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/

Re: Null response calling route

Posted by Nick Heudecker <nh...@gmail.com>.
Yes, I'm sure the destination receives the message.  The message body is
processed and the response set on the message out.

I've tried it with the direct: component and get the same result.  I've set
the InOut pattern everywhere I can see to set it and I'm not getting a
response body.

I don't see enrich() in my current snapshot.  When was it introduced in
2.0?

Thanks for your help.


On Sat, Feb 14, 2009 at 1:34 AM, Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> If you want to do a request-response with JMS you need to use InOut.
>
> You can use the requestBody method instead as its based on InOut.
>
> Are you sure the destination receives the JMS message? And that it
> returns a reply?
>
> Have you tried with some other transport than JMS, you can eg try a
> direct:foo and just produce a result manually in Camel to simulate the
> JMS stuff, to ensure the other parts is working okay. So its only the
> JMS reqeust-reply that is not working.
>
> BTW: We just recently added a new DSL enrich() for the content
> enricher EIP pattern:
> http://camel.apache.org/content-enricher.html
>
>
>
>
> On Sat, Feb 14, 2009 at 3:17 AM, Nick Heudecker <nh...@gmail.com>
> wrote:
> > Hi,
> >
> > I'm using camel 2.0 snapshot and trying to get a response back from the
> > first condition in the following choice():
> >
> >        from(JMS_JIS)
> >            .choice()
> >                .when().xpath("/jis:ListSupportedFeaturesRequest",
> > cisNamespace)
> >                    .unmarshal("camelJaxbDataFormat")
> >                    .setHeader("responsetype", constant(new
> > ListFeaturesResponseType()))
> >                    .to(ExchangePattern.InOut,
> > "filter:cisListSupportedFeaturesFilterChain")
> >                .when().xpath("/jis:ContentQueryRequest", cisNamespace)
> >                    .unmarshal("camelJaxbDataFormat")
> >                    .setHeader("responsetype", constant(new
> > ContentQueryResponseType()))
> >                    .to(ExchangePattern.InOut,
> > "filter:cisContentQueryRequestFilterChain")
> >                .otherwise()
> >                    .unmarshal("camelJaxbDataFormat")
> >                    .setHeader("responsetype", constant(new
> > ServiceCheckResponseType()))
> >                    .to(ExchangePattern.InOut,
> > "filter:serviceCheckFilterChain")
> >                .end();
> >
> > The "filter" component is one I created.  I can see that the result
> object
> > is being set at the end of my FilterProcessor, but the response returned
> > from:
> >
> > Object response = producerTemplate.sendBody(CamelRoutes.JMS_JIS,
> > ExchangePattern.InOut, xmlRequestBody);
> >
> > is null.  "xmlRequestBody" is just an XML string.  As far as I can tell,
> > everything is working fine except for getting back the result object.
> > Interestingly, if I change the sendBody(...) call to:
> >
> > Object response = producerTemplate.sendBody(CamelRoutes.JMS_JIS,
> > xmlRequestBody);
> >
> > I get the original XML returned as the response object.  I'm not sure
> what
> > that indicates, but it's not what I need to have happen.
> >
> > There is nothing in the logs to indicate an error in from the JMS or JAXB
> > components.
> >
> > I've been beating my head against this for a few hours and I don't know
> what
> > else I could try.  Any help is very much appreciated.  Thanks for your
> > time.
> >
> > Regards,
> > Nick
> >
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
>

Re: Null response calling route

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

If you want to do a request-response with JMS you need to use InOut.

You can use the requestBody method instead as its based on InOut.

Are you sure the destination receives the JMS message? And that it
returns a reply?

Have you tried with some other transport than JMS, you can eg try a
direct:foo and just produce a result manually in Camel to simulate the
JMS stuff, to ensure the other parts is working okay. So its only the
JMS reqeust-reply that is not working.

BTW: We just recently added a new DSL enrich() for the content
enricher EIP pattern:
http://camel.apache.org/content-enricher.html




On Sat, Feb 14, 2009 at 3:17 AM, Nick Heudecker <nh...@gmail.com> wrote:
> Hi,
>
> I'm using camel 2.0 snapshot and trying to get a response back from the
> first condition in the following choice():
>
>        from(JMS_JIS)
>            .choice()
>                .when().xpath("/jis:ListSupportedFeaturesRequest",
> cisNamespace)
>                    .unmarshal("camelJaxbDataFormat")
>                    .setHeader("responsetype", constant(new
> ListFeaturesResponseType()))
>                    .to(ExchangePattern.InOut,
> "filter:cisListSupportedFeaturesFilterChain")
>                .when().xpath("/jis:ContentQueryRequest", cisNamespace)
>                    .unmarshal("camelJaxbDataFormat")
>                    .setHeader("responsetype", constant(new
> ContentQueryResponseType()))
>                    .to(ExchangePattern.InOut,
> "filter:cisContentQueryRequestFilterChain")
>                .otherwise()
>                    .unmarshal("camelJaxbDataFormat")
>                    .setHeader("responsetype", constant(new
> ServiceCheckResponseType()))
>                    .to(ExchangePattern.InOut,
> "filter:serviceCheckFilterChain")
>                .end();
>
> The "filter" component is one I created.  I can see that the result object
> is being set at the end of my FilterProcessor, but the response returned
> from:
>
> Object response = producerTemplate.sendBody(CamelRoutes.JMS_JIS,
> ExchangePattern.InOut, xmlRequestBody);
>
> is null.  "xmlRequestBody" is just an XML string.  As far as I can tell,
> everything is working fine except for getting back the result object.
> Interestingly, if I change the sendBody(...) call to:
>
> Object response = producerTemplate.sendBody(CamelRoutes.JMS_JIS,
> xmlRequestBody);
>
> I get the original XML returned as the response object.  I'm not sure what
> that indicates, but it's not what I need to have happen.
>
> There is nothing in the logs to indicate an error in from the JMS or JAXB
> components.
>
> I've been beating my head against this for a few hours and I don't know what
> else I could try.  Any help is very much appreciated.  Thanks for your
> time.
>
> Regards,
> Nick
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/