You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Kasim Sert (Ibtech-Software Infrastructure)" <ka...@ibtech.com.tr> on 2015/11/17 10:23:26 UTC

Using BeanInvocation in camel cxf

Hi,

I am trying to develop a framework to invoke different web services based on their db definitions of SEI names and web method names and parameters etc.

To make this I found how to generate and BeanInvocation object from current web service definition. However I could not find any example on how to invoke this beaninvocation object.

Should it be something like :

From(direct:start)
                .bean(BeanInvocation,"invoke")

When I try this I get null pointer and even I dont know if this is right way to go.

Can anybody send an example usage on camel routes please ?


[Facebook]<http://www.facebook.com/Finansbank>  [Twitter] <http://twitter.com/finansbank>

[https://www.finansbank.com.tr/Disclaimer/BannerImages.aspx?date=17.11.201511:2300]<https://www.finansbank.com.tr/Disclaimer/Bannerlink.aspx?date=17.11.201511:2300>


Bu e-posta'n?n i?erdi?i bilgiler (ekleri dahil olmak ?zere) gizlidir. Onay?m?z olmaks?z?n ???nc? ki?ilere a?iklanamaz. Bu mesaj?n g?nderilmek istendi?i ki?i de?ilseniz, l?tfen mesaj? sisteminizden derhal siliniz. IBTech A.?. bu mesaj?n i?erdi?i bilgilerin do?rulu?u veya eksiksiz oldu?u konusunda bir garanti vermemektedir. Bu nedenle bilgilerin ne ?ekilde olursa olsun i?eri?inden, iletilmesinden, al?nmas?ndan, saklanmas?ndan sorumlu de?ildir. Bu mesaj?n i?eri?i yazar?na ait olup, IBTech A.?.'nin g?r??lerini i?ermeyebilir.

The information contained in this e-mail (including any attachments)is confidential. It must not be disclosed to any person without our authority. If you are not the intended recipient, please delete it from your system immediately. IBTech A.S. makes no warranty as to the accuracy or completeness of any information contained in this message and hereby excludes any liability of any kind for the information contained therein or for the information transmission, reception, storage or use of such in any way whatsoever. Any opinions expressed in this message are those of the author and may not necessarily reflect the opinions of IBTech A.S.

RE: Using BeanInvocation in camel cxf

Posted by "Kasim Sert (Ibtech-Software Infrastructure)" <ka...@ibtech.com.tr>.
Hi,

I have following route, generating the BeanInvocation manually. I am still not sure if that was necessary for ws call.

1)
from("direct:listCustomers")
	        .bean(Handler.class,"handleForward")
	        .bean(SOAPToBagTransformer.class)
	        .bean(QoSHandler.class)
	        .bean(CxfUtils.class,"cxfToPojo")
	        //here we have beanInvocation as message
	        .to(cxfEndpoint)
	        .bean(Handler.class,"handleBackward");

And I get following error.

Caused by: java.lang.ClassCastException: org.apache.camel.component.bean.BeanInvocation incompatible with java.lang.String

2)
When I do that it works,

from("direct:listCustomers")
	.bean(Handler.class,"handleForward")
	.bean(SOAPToBagTransformer.class)
	.bean(QoSHandler.class)
	.bean(CxfUtils.class,"cxfToPojo")
	//here we have beanInvocation as message
	.process(new Processor() {
		@Override
		public void process(Exchange e) throws Exception {
			final BeanInvocation bi = e.getIn().getBody( BeanInvocation.class );
			e.getIn().setBody( bi.getArgs() );
		}
	})
	.to(cxfEndpoint)
	.bean(Handler.class,"handleBackward");

However in that case generating InvocationBean is not necessary I think, just setting the message with appropriate ws parameters will also work..

3)
And finally when I invoke BeanInvocation it gets following exception.

from("direct:listCustomers")
	.bean(Handler.class,"handleForward")
	.bean(SOAPToBagTransformer.class)
	.bean(QoSHandler.class)
	.bean(CxfUtils.class,"cxfToPojo")
	//here we have beanInvocation as message
	.bean(BeanInvocation.class)
	.to(cxfEndpoint)
	.bean(Handler.class,"handleBackward");

org.apache.camel.RuntimeCamelException: java.lang.NullPointerException
	at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1619)
	at org.apache.camel.component.bean.BeanInvocation.invoke(BeanInvocation.java:89)


-----Original Message-----
From: Henryk Konsek [mailto:hekonsek@gmail.com] 
Sent: Tuesday, November 17, 2015 6:10 PM
To: users@camel.apache.org
Subject: Re: Using BeanInvocation in camel cxf

Hi Kasim,

Your route should work - it looks fine (just replace BeanInvocation with BeanInvocation.class).
Can you send us the stacktrace you see?

Cheers!

wt., 17.11.2015 o 16:08 użytkownik Steve Huston <sh...@riverace.com>
napisał:

> I have this excerpt from a Camel route in blueprint XML:
>
>   <bean id="crewService" class="my.package.path.CrewService"/>
>  <route>
>      <from uri="seda:from_rraa"/>
>     ....
>   <bean ref="crewService" method="translateTo"/>
>    ...
> </route>
>
> > -----Original Message-----
> > From: Kasim Sert (Ibtech-Software Infrastructure) 
> > [mailto:kasim.sert@ibtech.com.tr]
> > Sent: Tuesday, November 17, 2015 4:23 AM
> > To: users@camel.apache.org
> > Subject: Using BeanInvocation in camel cxf
> >
> > Hi,
> >
> > I am trying to develop a framework to invoke different web services 
> > based on their db definitions of SEI names and web method names and 
> > parameters etc.
> >
> > To make this I found how to generate and BeanInvocation object from 
> > current web service definition. However I could not find any example 
> > on
> how
> > to invoke this beaninvocation object.
> >
> > Should it be something like :
> >
> > From(direct:start)
> >                 .bean(BeanInvocation,"invoke")
> >
> > When I try this I get null pointer and even I dont know if this is 
> > right
> way to
> > go.
> >
> > Can anybody send an example usage on camel routes please ?
> >
> >
> > [Facebook]<http://www.facebook.com/Finansbank>  [Twitter] 
> > <http://twitter.com/finansbank>
> >
> > [https://www.finansbank.com.tr/Disclaimer/BannerImages.aspx?date=17.
> > 11 
> > .201511:2300]<https://www.finansbank.com.tr/Disclaimer/Bannerlink.aspx?
> > date=17.11.201511:2300>
> >
> >
> > Bu e-posta'n?n i?erdi?i bilgiler (ekleri dahil olmak ?zere) gizlidir.
> Onay?m?z
> > olmaks?z?n ???nc? ki?ilere a?iklanamaz. Bu mesaj?n g?nderilmek 
> > istendi?i ki?i de?ilseniz, l?tfen mesaj? sisteminizden derhal siliniz. IBTech A.?.
> bu
> > mesaj?n i?erdi?i bilgilerin do?rulu?u veya eksiksiz oldu?u konusunda 
> > bir garanti vermemektedir. Bu nedenle bilgilerin ne ?ekilde olursa 
> > olsun i?eri?inden, iletilmesinden, al?nmas?ndan, saklanmas?ndan 
> > sorumlu
> de?ildir.
> > Bu mesaj?n i?eri?i yazar?na ait olup, IBTech A.?.'nin g?r??lerini
> i?ermeyebilir.
> >
> > The information contained in this e-mail (including any 
> > attachments)is confidential. It must not be disclosed to any person 
> > without our
> authority. If
> > you are not the intended recipient, please delete it from your 
> > system immediately. IBTech A.S. makes no warranty as to the accuracy 
> > or completeness of any information contained in this message and 
> > hereby excludes any liability of any kind for the information 
> > contained therein
> or for
> > the information transmission, reception, storage or use of such in 
> > any
> way
> > whatsoever. Any opinions expressed in this message are those of the
> author
> > and may not necessarily reflect the opinions of IBTech A.S.
>
--
Henryk Konsek
http://about.me/hekonsek


Bu e-posta'nin içerdigi bilgiler (ekleri dahil olmak 
üzere) gizlidir. Onayimiz olmaksizin üçüncü kisilere açiklanamaz. Bu mesajin 
gönderilmek istendigi kisi degilseniz, lütfen mesaji sisteminizden derhal 
siliniz. IBTech A.S. bu mesajin içerdigi bilgilerin dogrulugu veya eksiksiz 
oldugu konusunda bir garanti vermemektedir. Bu nedenle bilgilerin ne sekilde 
olursa olsun içeriginden, iletilmesinden, alinmasindan, saklanmasindan sorumlu 
degildir. Bu mesajin içerigi yazarina ait olup, IBTech A.S.'nin görüslerini 
içermeyebilir.

The information contained in this e-mail (including any 
attachments)is confidential. It must not be disclosed to any person without our 
authority. If you are not the intended recipient, please delete it from your 
system immediately. IBTech A.S. makes no warranty as to the accuracy or 
completeness of any information contained in this message and hereby excludes 
any liability of any kind for the information contained therein or for the 
information transmission, reception, storage or use of such in any way 
whatsoever. Any opinions expressed in this message are those of the author and 
may not necessarily reflect the opinions of IBTech 
A.S.

Re: Using BeanInvocation in camel cxf

Posted by Henryk Konsek <he...@gmail.com>.
Hi Kasim,

Your route should work - it looks fine (just replace BeanInvocation
with BeanInvocation.class).
Can you send us the stacktrace you see?

Cheers!

wt., 17.11.2015 o 16:08 użytkownik Steve Huston <sh...@riverace.com>
napisał:

> I have this excerpt from a Camel route in blueprint XML:
>
>   <bean id="crewService" class="my.package.path.CrewService"/>
>  <route>
>      <from uri="seda:from_rraa"/>
>     ....
>   <bean ref="crewService" method="translateTo"/>
>    ...
> </route>
>
> > -----Original Message-----
> > From: Kasim Sert (Ibtech-Software Infrastructure)
> > [mailto:kasim.sert@ibtech.com.tr]
> > Sent: Tuesday, November 17, 2015 4:23 AM
> > To: users@camel.apache.org
> > Subject: Using BeanInvocation in camel cxf
> >
> > Hi,
> >
> > I am trying to develop a framework to invoke different web services based
> > on their db definitions of SEI names and web method names and parameters
> > etc.
> >
> > To make this I found how to generate and BeanInvocation object from
> > current web service definition. However I could not find any example on
> how
> > to invoke this beaninvocation object.
> >
> > Should it be something like :
> >
> > From(direct:start)
> >                 .bean(BeanInvocation,"invoke")
> >
> > When I try this I get null pointer and even I dont know if this is right
> way to
> > go.
> >
> > Can anybody send an example usage on camel routes please ?
> >
> >
> > [Facebook]<http://www.facebook.com/Finansbank>  [Twitter]
> > <http://twitter.com/finansbank>
> >
> > [https://www.finansbank.com.tr/Disclaimer/BannerImages.aspx?date=17.11
> > .201511:2300]<https://www.finansbank.com.tr/Disclaimer/Bannerlink.aspx?
> > date=17.11.201511:2300>
> >
> >
> > Bu e-posta'n?n i?erdi?i bilgiler (ekleri dahil olmak ?zere) gizlidir.
> Onay?m?z
> > olmaks?z?n ???nc? ki?ilere a?iklanamaz. Bu mesaj?n g?nderilmek istendi?i
> > ki?i de?ilseniz, l?tfen mesaj? sisteminizden derhal siliniz. IBTech A.?.
> bu
> > mesaj?n i?erdi?i bilgilerin do?rulu?u veya eksiksiz oldu?u konusunda bir
> > garanti vermemektedir. Bu nedenle bilgilerin ne ?ekilde olursa olsun
> > i?eri?inden, iletilmesinden, al?nmas?ndan, saklanmas?ndan sorumlu
> de?ildir.
> > Bu mesaj?n i?eri?i yazar?na ait olup, IBTech A.?.'nin g?r??lerini
> i?ermeyebilir.
> >
> > The information contained in this e-mail (including any attachments)is
> > confidential. It must not be disclosed to any person without our
> authority. If
> > you are not the intended recipient, please delete it from your system
> > immediately. IBTech A.S. makes no warranty as to the accuracy or
> > completeness of any information contained in this message and hereby
> > excludes any liability of any kind for the information contained therein
> or for
> > the information transmission, reception, storage or use of such in any
> way
> > whatsoever. Any opinions expressed in this message are those of the
> author
> > and may not necessarily reflect the opinions of IBTech A.S.
>
-- 
Henryk Konsek
http://about.me/hekonsek

RE: Using BeanInvocation in camel cxf

Posted by Steve Huston <sh...@riverace.com>.
I have this excerpt from a Camel route in blueprint XML:

  <bean id="crewService" class="my.package.path.CrewService"/>
 <route>
     <from uri="seda:from_rraa"/>
    ....
  <bean ref="crewService" method="translateTo"/>
   ...
</route>

> -----Original Message-----
> From: Kasim Sert (Ibtech-Software Infrastructure)
> [mailto:kasim.sert@ibtech.com.tr]
> Sent: Tuesday, November 17, 2015 4:23 AM
> To: users@camel.apache.org
> Subject: Using BeanInvocation in camel cxf
> 
> Hi,
> 
> I am trying to develop a framework to invoke different web services based
> on their db definitions of SEI names and web method names and parameters
> etc.
> 
> To make this I found how to generate and BeanInvocation object from
> current web service definition. However I could not find any example on how
> to invoke this beaninvocation object.
> 
> Should it be something like :
> 
> From(direct:start)
>                 .bean(BeanInvocation,"invoke")
> 
> When I try this I get null pointer and even I dont know if this is right way to
> go.
> 
> Can anybody send an example usage on camel routes please ?
> 
> 
> [Facebook]<http://www.facebook.com/Finansbank>  [Twitter]
> <http://twitter.com/finansbank>
> 
> [https://www.finansbank.com.tr/Disclaimer/BannerImages.aspx?date=17.11
> .201511:2300]<https://www.finansbank.com.tr/Disclaimer/Bannerlink.aspx?
> date=17.11.201511:2300>
> 
> 
> Bu e-posta'n?n i?erdi?i bilgiler (ekleri dahil olmak ?zere) gizlidir. Onay?m?z
> olmaks?z?n ???nc? ki?ilere a?iklanamaz. Bu mesaj?n g?nderilmek istendi?i
> ki?i de?ilseniz, l?tfen mesaj? sisteminizden derhal siliniz. IBTech A.?. bu
> mesaj?n i?erdi?i bilgilerin do?rulu?u veya eksiksiz oldu?u konusunda bir
> garanti vermemektedir. Bu nedenle bilgilerin ne ?ekilde olursa olsun
> i?eri?inden, iletilmesinden, al?nmas?ndan, saklanmas?ndan sorumlu de?ildir.
> Bu mesaj?n i?eri?i yazar?na ait olup, IBTech A.?.'nin g?r??lerini i?ermeyebilir.
> 
> The information contained in this e-mail (including any attachments)is
> confidential. It must not be disclosed to any person without our authority. If
> you are not the intended recipient, please delete it from your system
> immediately. IBTech A.S. makes no warranty as to the accuracy or
> completeness of any information contained in this message and hereby
> excludes any liability of any kind for the information contained therein or for
> the information transmission, reception, storage or use of such in any way
> whatsoever. Any opinions expressed in this message are those of the author
> and may not necessarily reflect the opinions of IBTech A.S.