camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: RestFul Services using CAMEL
Date Mon, 09 Apr 2012 08:39:52 GMT
On Sun Apr  8 09:14:05 2012, RR wrote:
> I am a newbie to CAMEL. Pardon me if this is a so naive.
>
> Our users are going to call a REST webservice that's going to load a very
> big XML file and respond back only a portion of the XML. I came across
> tokenizeXML() in Splitter EAI pattern and played around a bit and works
> great stand-alone.
>
> But I am not able to implement this while try to integrate with CXF
> Webservice.
>
> In my beans.xml I have,
>
> <bean id="demoService" name="demoService" class="com.hrb.demo.DemoService">
> </bean>
> <jaxrs:server id="demo" address="/demo">
> 	<jaxrs:serviceBeans>
> 		<ref bean="demoService" />
> 	</jaxrs:serviceBeans>
> </jaxrs:server>
>
> <cxf:rsServer id="myServer" address="/demo"
> 		serviceClass="com.hrb.demo.DemoService" />
>
> <camelContext id="mycamelContext"
> xmlns="http://camel.apache.org/schema/spring">
> 	<package>com.hrb.demo</package>
> </camelContext>
>
> and I want my Routerclass to process the request by loading the XML using
> split(), tokenizeXML() and streaming() and send the response back.
>
> from("cxfrs://bean:myServer"). process(new Processor() {
> 			public void process(Exchange arg0) throws Exception {
>                               //THE FILE order.dat is compressed..
> 				File file = new File(
> 						"C:\\temp\order.dat");
> 				ZipFile zipfile = new ZipFile(file);
> 				Enumeration e = zipfile.entries();
> 				ZipEntry entry = null;
> 				while (e.hasMoreElements()) {
> 					entry = (ZipEntry) e.nextElement();
> 				}
>                           // I WANT TO SEND THIS STREAM TO THE NEXT
> ROUTE..BUT NOT SURE HOW???
You can use the ProducerTemplate[1] to send the message to the other 
route.
But I'm not sure why your route start with the camel-cxfrs consumer, 
but you processor doesn't use the request.


> 			}
> 		}).split().tokenizeXML("Order").streaming().process(new Processor() {
>
>                              // IF THE TOKENIZED STRING IS EQUAL TO CERTAIN
> VALUE,
>                             // I WANT TO SET THE RESPONSE FOR REST SERVICE.
Yeah, you can put the response here.
>                   }.end();
>
> }
>
> I dont know whether it's possbile to do this way via CAMEL. Any help is
> greatly appreciated.
>
> Thanks,
> RR
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/RestFul-Services-using-CAMEL-tp5625332p5625332.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang


Mime
View raw message