You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Heiko <he...@ciber.com> on 2013/03/21 14:15:25 UTC

Cannot read inbound mesage from CXF webservice

Hi,
I have a problem while calling a webservice from a camel route. The inbound
message is set, like this prompt tells me, but I any attempt to read that
leads to a nullpointer exeption, since the body in suddenly null.

Can anybody tell me, what I´m doing wrong or how to access webservice
result?

This is my commandline output:


This is my route:


This is the called bean method createTemisAuthetificationMessage:

* I tried inOnly and inOut as well

This is the called bean method setTemisWebServiceTokenToHeader:

* I tried both resultIn and resultOut



--
View this message in context: http://camel.465427.n5.nabble.com/Cannot-read-inbound-mesage-from-CXF-webservice-tp5729613.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Cannot read inbound mesage from CXF webservice

Posted by Heiko <he...@ciber.com>.
Some more hints:
I added an enrich pattern to my route to inspect all bodies and enabled
stream-caching. Same result as a custom / System.out command line output:

oldExchange.getIn(): here the input appears, which triggers my file
component endpoint
oldExchange.getOut(): null
newExchange.getIn(): null
newExchange.getOut(): null

I would be really glad about an answer, because other I have to kick camel
into the bin for that task and call the Webservices from a bean using a
client.



--
View this message in context: http://camel.465427.n5.nabble.com/Cannot-read-inbound-mesage-from-CXF-webservice-tp5729613p5729624.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Cannot read inbound mesage from CXF webservice

Posted by Christian Müller <ch...@gmail.com>.
Hi Heiko!

Good to know you could solve the issue by yourself.

If you want to check whether your exchange already has an out message, you
can call:
exchange.hasOut();

Best,
Christian

On Fri, Mar 22, 2013 at 12:29 PM, Heiko <he...@ciber.com> wrote:

> Hi guys,
>
> It´s me again. I finally solved the issue.
> @Christian: You gave me the right trace with "don´t call the
> exchange.getOut()", since that creates an new out message.
> @Claus: Also thanks to you for the link to the docs I read through.
>
> Many Thanks.
>
> Camel rocks! :o)
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Cannot-read-inbound-message-from-CXF-webservice-empty-message-body-tp5729613p5729676.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--

Re: Cannot read inbound mesage from CXF webservice

Posted by Heiko <he...@ciber.com>.
Hi guys,

It´s me again. I finally solved the issue.
@Christian: You gave me the right trace with "don´t call the
exchange.getOut()", since that creates an new out message.
@Claus: Also thanks to you for the link to the docs I read through.

Many Thanks.

Camel rocks! :o)



--
View this message in context: http://camel.465427.n5.nabble.com/Cannot-read-inbound-message-from-CXF-webservice-empty-message-body-tp5729613p5729676.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Cannot read inbound mesage from CXF webservice

Posted by Heiko <he...@ciber.com>.
Hi Christian,

Please see my post on Claus reply.

But for both of you here is my boring AggregationStrategy I forgot to paste:





--
View this message in context: http://camel.465427.n5.nabble.com/Cannot-read-inbound-message-from-CXF-webservice-empty-message-body-tp5729613p5729662.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Cannot read inbound mesage from CXF webservice

Posted by Christian Müller <ch...@gmail.com>.
You should not call:
exchange.getOut() in "setTemisWebServiceTokenToHeader".
This will create an empty out message which is afterwards send to the next
processor...

Best,
Christian

On Thu, Mar 21, 2013 at 2:15 PM, Heiko <he...@ciber.com> wrote:

> Hi,
> I have a problem while calling a webservice from a camel route. The inbound
> message is set, like this prompt tells me, but I any attempt to read that
> leads to a nullpointer exeption, since the body in suddenly null.
>
> Can anybody tell me, what I´m doing wrong or how to access webservice
> result?
>
> This is my commandline output:
>
>
> This is my route:
>
>
> This is the called bean method createTemisAuthetificationMessage:
>
> * I tried inOnly and inOut as well
>
> This is the called bean method setTemisWebServiceTokenToHeader:
>
> * I tried both resultIn and resultOut
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Cannot-read-inbound-mesage-from-CXF-webservice-tp5729613.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--

Re: Cannot read inbound mesage from CXF webservice

Posted by Heiko <he...@ciber.com>.
Thanks Claus & Christian,

I tried everything you both recommended before and it still doesn´t worked
out for me.

@Claus: Yes, I think I already defined an InOut route. Please proove from
the route def. Am I wrong?
@Claus: Yes, I already activated stream caching, since this route is
streambased. My understanding it, that I have to activate the stream caching
either per route or per context. Is my route defintion wrong?

@Christian: You brought up an interessting point I didn´t took into account
so far. I stripped the call or exchange.getOut() method. Didn´t work,
eigther :o(

So, hopefully all cables are connected. Hope you guys find my mistake.

My route now looks like this:


createTemisAuthetificationMessage stayed the same as it was before.

My setTemisWebServiceTokenToHeader now looks like this:


But unfortunately this is my output. Still no body there:





--
View this message in context: http://camel.465427.n5.nabble.com/Cannot-read-inbound-message-from-CXF-webservice-empty-message-body-tp5729613p5729661.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Cannot read inbound mesage from CXF webservice

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Mar 21, 2013 at 2:15 PM, Heiko <he...@ciber.com> wrote:
> Hi,
> I have a problem while calling a webservice from a camel route. The inbound
> message is set, like this prompt tells me, but I any attempt to read that
> leads to a nullpointer exeption, since the body in suddenly null.
>

See this FAQ
http://camel.apache.org/why-is-my-message-body-empty.html


> Can anybody tell me, what I´m doing wrong or how to access webservice
> result?
>
> This is my commandline output:
>
>
> This is my route:
>
>
> This is the called bean method createTemisAuthetificationMessage:
>
> * I tried inOnly and inOut as well
>
> This is the called bean method setTemisWebServiceTokenToHeader:
>
> * I tried both resultIn and resultOut
>

See this FAQ
http://camel.apache.org/using-getin-or-getout-methods-on-exchange.html

And maybe also read about stream caching
http://camel.apache.org/stream-caching.html

>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Cannot-read-inbound-mesage-from-CXF-webservice-tp5729613.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen