Return-Path: Delivered-To: apmail-activemq-camel-user-archive@locus.apache.org Received: (qmail 70741 invoked from network); 23 Oct 2008 12:30:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 23 Oct 2008 12:30:44 -0000 Received: (qmail 84653 invoked by uid 500); 23 Oct 2008 12:30:47 -0000 Delivered-To: apmail-activemq-camel-user-archive@activemq.apache.org Received: (qmail 84521 invoked by uid 500); 23 Oct 2008 12:30:47 -0000 Mailing-List: contact camel-user-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: camel-user@activemq.apache.org Delivered-To: mailing list camel-user@activemq.apache.org Received: (qmail 84510 invoked by uid 99); 23 Oct 2008 12:30:47 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Oct 2008 05:30:47 -0700 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [195.69.129.178] (HELO exsmtp02.exserver.dk) (195.69.129.178) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Oct 2008 12:29:33 +0000 Received: from EXVS04.exserver.dk ([10.10.10.84]) by exsmtp02.exserver.dk with Microsoft SMTPSVC(6.0.3790.1830); Thu, 23 Oct 2008 14:27:33 +0200 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: XStream with JBI Date: Thu, 23 Oct 2008 14:29:25 +0200 Message-ID: <4C1FB9C00D24A140906239533638C4D205CDA6CF@EXVS04.exserver.dk> In-Reply-To: <20129812.post@talk.nabble.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: XStream with JBI Thread-Index: Ack1Cds29WwYAGnjQjKFqmoyfhnXmQAAGs/w From: "Claus Ibsen" To: X-OriginalArrivalTime: 23 Oct 2008 12:27:33.0054 (UTC) FILETIME=[B93DA5E0:01C9350A] X-Virus-Checked: Checked by ClamAV on apache.org Hi Yeah use a BEAN and send the body using ProducerTemplate, then it really = should be a new exchange. > from("jbi:service:http://www.mycompany.org/xstreamService") > .convertBodyTo(String.class).to("bean:myBean") You then configure myBean in the registry (eg spring xml) If you don't know how to get a ProducerTemplate injected then see for = instance the AXIS tutorial: http://activemq.apache.org/camel/tutorial-axis-camel.html You can also use annotations to get it injected And in MyBean public void doSomething(String body) { ... producer.sendBody("seda:foo", body); } Or use Exchange as the parameter and get the camel context from that one = and invoke createProducerTemplate public void doSomething(Exchange exchange) { exchanage.getCamelContext().createProducerTeamplate() =20 Med venlig hilsen =20 Claus Ibsen ...................................... Silverbullet Skovsg=E5rdsv=E6nget 21 8362 H=F8rning Tlf. +45 2962 7576 Web: www.silverbullet.dk -----Original Message----- From: raulvk.soa [mailto:raulvk.soa@gmail.com]=20 Sent: 23. oktober 2008 14:23 To: camel-user@activemq.apache.org Subject: RE: XStream with JBI Hi Claus, Just tried it and it still continues being a JbiMessage with a NormalisedMessageImpl objects as the in message. Any other ideas? Claus Ibsen wrote: >=20 > Hi >=20 > You can send the jbi stuff to a seda queue, and then poll the seda = queue > in a 2nd route. Then it should be a new Exchange and a Camel exchange = as a > org.apache.camel.impl.DefaultExchange object. >=20 >=20 > from("jbi:service:http://www.mycompany.org/xstreamService") > .convertBodyTo(String.class).to("seda:foo") >=20 > From("seda:foo")... >=20 > =20 >=20 > Med venlig hilsen > =20 > Claus Ibsen > ...................................... > Silverbullet > Skovsg=E5rdsv=E6nget 21 > 8362 H=F8rning > Tlf. +45 2962 7576 > Web: www.silverbullet.dk >=20 > -----Original Message----- > From: raulvk.soa [mailto:raulvk.soa@gmail.com]=20 > Sent: 23. oktober 2008 13:48 > To: camel-user@activemq.apache.org > Subject: Re: XStream with JBI >=20 >=20 >=20 > XStream does not throw any exception (probably because it does its > processing well and it returns the generated object). However, the = object > returned by XStream is not set as the IN message because it is not = XML. > When > iBATIS receives the message, it throws an exception because the Body = is > NULL. >=20 > I have created the following test to illustrate this behaviour: >=20 >=20 > XStream xst =3D new XStream(); > xst.alias("Person", Person.class); > XStreamDataFormat xstdf =3D new XStreamDataFormat(); > xstdf.setXStream(xst); >=20 >=20 > from("jbi:service:http://www.mycompany.org/xstreamService") > .convertBodyTo(String.class).process(new Processor() { > public void process(Exchange exchange) throws Exception { > System.out.println("11111111-------------------->>>>>> " + > exchange.getIn()); > if (exchange.getIn() !=3D null) > System.out.println("::::: Body: " + = exchange.getIn().getBody()); > else > System.out.println("::::: Body IS NULL"); > } > }) > .unmarshal(xstdf).process(new Processor() { > public void process(Exchange exchange) throws Exception { > System.out.println("22222222-------------------->>>>>> " + > exchange.getIn()); > if (exchange.getIn() !=3D null) > System.out.println("::::: Body: " + = exchange.getIn().getBody()); > else > System.out.println("::::: Body IS NULL"); > } > }) >=20 >=20 > Basically, this is what happens:=20 > - before XStream --> the in message is of type = NormalisedMessageImpl, > and > the body is of type DOMSource. > - after XStream --> the in message is of type = NormalisedMessageImpl, > and > the body is NULL. >=20 > Basically, a solution that comes to mind is to convert the JbiExchange = to > a > standard Camel Exchange... but where can I do this? I can't do this in = a > Processor, because it wont allow me to SUBSTITUTE the exchange = itself.... >=20 > Any ideas? >=20 >=20 >=20 > Gert Vanthienen wrote: >>=20 >> L.S., >>=20 >> What is the exception or error you are getting? We should definitely = >> support this use case out-of-the-box... >>=20 >> Regards, >>=20 >> Gert >>=20 >> raulvk.soa wrote: >>> Hi, >>> >>> I am using Camel embedded in ServiceMix. My camel route receives a = JBI >>> message, turns it into a Java Object by using XStream and then = passes it >>> on >>> to iBATIS. >>> >>> However, I am facing problems with the XStream processing. I suspect >>> that >>> these are derived from the fact that the underlying Camel Exchange = is >>> actually a JbiExchange which only accepts XML as the in and out body >>> messages. >>> >>> Therefore, I need to get rid of all the Jbi stuff and simply use a >>> standard >>> Camel Exchange which will allow me to set an Object as the in = message. >>> >>> Is it possible to do so out of the box? >>> >>> Thanks! >>> =20 >>=20 >>=20 >>=20 >> ----- >> --- >> Gert Vanthienen >> http://gertvanthienen.blogspot.com >>=20 >=20 > --=20 > View this message in context: > http://www.nabble.com/XStream-with-JBI-tp20129124s22882p20129325.html > Sent from the Camel - Users mailing list archive at Nabble.com. >=20 >=20 >=20 --=20 View this message in context: = http://www.nabble.com/XStream-with-JBI-tp20129124s22882p20129812.html Sent from the Camel - Users mailing list archive at Nabble.com.