You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by pranay6723 <pr...@gmail.com> on 2011/08/30 08:57:29 UTC

Creating a simple REST web service using servicemix camel

Hi,
I want to create a simple REST web service  using camel spring and
servicemix.. can anybody post a sample code..
I am a newbie to servicemix 

Thanks in advance,
Pranay

--
View this message in context: http://servicemix.396122.n5.nabble.com/Creating-a-simple-REST-web-service-using-servicemix-camel-tp4749070p4749070.html
Sent from the ServiceMix - Dev mailing list archive at Nabble.com.

Re: Creating a simple REST web service using servicemix camel

Posted by pranay6723 <pr...@gmail.com>.
Hi Jon,
Thanks for your reply..
I have referred the link http://camel.apache.org/cxfrs.html 
but i havent got any idea where to write the  createRouteBuilder() method as
I am newbie to camel servicemix,


Actually What I want to  do is, I am having my data (in XML format) in 
activemq QUEUE, now i want to make it available for customers. For that i
want to create a REST web service. The customers will call that webservice
by sending GET or POST requests and retrieve that XML data. Is it possible??
I want to do it using Spring DSL and servicemix. If you are having some
sample code regarding this please provide me..

thanks,
Pranay

--
View this message in context: http://servicemix.396122.n5.nabble.com/Creating-a-simple-REST-web-service-using-servicemix-camel-tp4749070p4753194.html
Sent from the ServiceMix - Dev mailing list archive at Nabble.com.

Re: Creating a simple REST web service using servicemix camel

Posted by pranay6723 <pr...@gmail.com>.
Hi Jean,


Actually What I want to  do is, I am having my data (in XML format) in 
activemq QUEUE, now i want to make it available for customers. For that i
want to create a REST web service. The customers will call that webservice
by sending GET or POST requests and retrieve that XML data. Is it possible??
I want to do it using Spring DSL and servicemix. If you are having some
sample code regarding this please provide me.. 

can you tell me how to read activemq QUEUE and send the message/data to a
rest web service??
I am stuck over this now..


Regards, 
Pranay

--
View this message in context: http://servicemix.396122.n5.nabble.com/Creating-a-simple-REST-web-service-using-servicemix-camel-tp4749070p4754357.html
Sent from the ServiceMix - Dev mailing list archive at Nabble.com.

Re: Creating a simple REST web service using servicemix camel

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Cool ;)

Regards
JB

On 08/31/2011 12:41 PM, pranay6723 wrote:
> Hi Jean,
>
> This example is working now, the rest service is running on my local machine
> now, I have changed my camel version to 2.6.0, I really appreciate your
> help.. thanks for your valuable help and your time..
> Now i will try what i want to do exactly, If i will get any problem I will
> share it on this forum..
>
> Thanks to all
>
> Regards,
> Pranay
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/Creating-a-simple-REST-web-service-using-servicemix-camel-tp4749070p4753688.html
> Sent from the ServiceMix - Dev mailing list archive at Nabble.com.

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Creating a simple REST web service using servicemix camel

Posted by pranay6723 <pr...@gmail.com>.
Hi Jean,

This example is working now, the rest service is running on my local machine
now, I have changed my camel version to 2.6.0, I really appreciate your
help.. thanks for your valuable help and your time..
Now i will try what i want to do exactly, If i will get any problem I will
share it on this forum..

Thanks to all

Regards,
Pranay

--
View this message in context: http://servicemix.396122.n5.nabble.com/Creating-a-simple-REST-web-service-using-servicemix-camel-tp4749070p4753688.html
Sent from the ServiceMix - Dev mailing list archive at Nabble.com.

Re: Creating a simple REST web service using servicemix camel

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Pranay,

In my example, I use Camel 2.8.0. But, if you use ServiceMix 4.3.0, the 
Camel version is 2.6.0.

You have to update the POM to use Camel 2.6.0 in place of 2.8.0.

Regards
JB

On 08/31/2011 10:55 AM, pranay6723 wrote:
> HI Jean,
> exactly it was the same error.. there was already a bundle installed.. i
> have uninstalled it and tried to re-execute the same command osfi:install
> ******* ".  Now  it is giving me error..
>
> Error executing command: Unresolved constraint in bundle Spring_REST [244]:
> Unable to resolve 244.0: missing requirement [244.0] package;
> (&(package=org.apache.camel)(version>=2.8.0)(!(version>=3.0.0)))
>
> please reply,
>
> Regards,
> Pranay
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/Creating-a-simple-REST-web-service-using-servicemix-camel-tp4749070p4753437.html
> Sent from the ServiceMix - Dev mailing list archive at Nabble.com.

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Creating a simple REST web service using servicemix camel

Posted by pranay6723 <pr...@gmail.com>.
HI Jean,
exactly it was the same error.. there was already a bundle installed.. i
have uninstalled it and tried to re-execute the same command osfi:install
******* ".  Now  it is giving me error..

Error executing command: Unresolved constraint in bundle Spring_REST [244]:
Unable to resolve 244.0: missing requirement [244.0] package;
(&(package=org.apache.camel)(version>=2.8.0)(!(version>=3.0.0)))

please reply,

Regards,
Pranay

--
View this message in context: http://servicemix.396122.n5.nabble.com/Creating-a-simple-REST-web-service-using-servicemix-camel-tp4749070p4753437.html
Sent from the ServiceMix - Dev mailing list archive at Nabble.com.

Re: Creating a simple REST web service using servicemix camel

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Pranay,

Maybe you have already a bundle deployed which has the same symbolic 
name (my-artifactid). Check if it's not the case and rename it.

Regards
JB

On 08/31/2011 08:45 AM, pranay6723 wrote:
> HI Jean
> Thanks for the reply,
>
> I referred the link
> http://blog.nanthrax.net/2011/08/use-camel-cxf-and-karaf-to-implement-batches/
> and i created the maven project and followed the procedure step by step..
> but while installing bundle in karaf it is giving me error ..
>
> karaf@root>  osgi:install -s mvn:com.mygroupid/my-artifactid/1.0-SNAPSHOT
> org.osgi.framework.BundleException: Bundle symbolic name and version are not
> unique: my-artifactid:*1.0.0.SNAPSHOT*
>
> my pom.xml is
> <modelVersion>4.0.0</modelVersion>
>
>    <groupId>com.mygroupid</groupId>
>    <artifactId>my-artifactid</artifactId>
>    <packaging>bundle</packaging>
>    <version>1.0-SNAPSHOT</version>
>
> other part of pom is just like copy of which you provided there..
>
> I am using maven 3.0.3 , camel 2.8.0 and servicemix 4.3.0 versions
>
>
> Actually What I want to  do is, I am having my data (in XML format) in
> activemq QUEUE, now i want to make it available for customers. For that i
> want to create a REST web service. The customers will call that webservice
> by sending GET or POST requests and retrieve that XML data. Is it possible??
> I want to do it using Spring DSL and servicemix. If you are having some
> sample code regarding this please provide me..
>
> thanks,
> Pranay
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/Creating-a-simple-REST-web-service-using-servicemix-camel-tp4749070p4753128.html
> Sent from the ServiceMix - Dev mailing list archive at Nabble.com.

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Creating a simple REST web service using servicemix camel

Posted by pranay6723 <pr...@gmail.com>.
HI Jean
Thanks for the reply,

I referred the link
http://blog.nanthrax.net/2011/08/use-camel-cxf-and-karaf-to-implement-batches/
and i created the maven project and followed the procedure step by step..
but while installing bundle in karaf it is giving me error ..

karaf@root> osgi:install -s mvn:com.mygroupid/my-artifactid/1.0-SNAPSHOT
org.osgi.framework.BundleException: Bundle symbolic name and version are not
unique: my-artifactid:*1.0.0.SNAPSHOT*

my pom.xml is
<modelVersion>4.0.0</modelVersion>

  <groupId>com.mygroupid</groupId>
  <artifactId>my-artifactid</artifactId>
  <packaging>bundle</packaging>
  <version>1.0-SNAPSHOT</version>

other part of pom is just like copy of which you provided there..

I am using maven 3.0.3 , camel 2.8.0 and servicemix 4.3.0 versions


Actually What I want to  do is, I am having my data (in XML format) in 
activemq QUEUE, now i want to make it available for customers. For that i
want to create a REST web service. The customers will call that webservice
by sending GET or POST requests and retrieve that XML data. Is it possible??
I want to do it using Spring DSL and servicemix. If you are having some
sample code regarding this please provide me..

thanks,
Pranay

--
View this message in context: http://servicemix.396122.n5.nabble.com/Creating-a-simple-REST-web-service-using-servicemix-camel-tp4749070p4753128.html
Sent from the ServiceMix - Dev mailing list archive at Nabble.com.

Re: Creating a simple REST web service using servicemix camel

Posted by pranay6723 <pr...@gmail.com>.
Hi Jean,

I have reffered your code for creating rest service.. it is working fine ..
i want to make it secure now.. how can we convert it to "https" ?

please help..

Thanks,
Pranay

--
View this message in context: http://servicemix.396122.n5.nabble.com/Creating-a-simple-REST-web-service-using-servicemix-camel-tp4749070p4802315.html
Sent from the ServiceMix - Dev mailing list archive at Nabble.com.

Re: Creating a simple REST web service using servicemix camel

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

you can also take a look on:
http://blog.nanthrax.net/2011/08/use-camel-cxf-and-karaf-to-implement-batches/

I blogged about how to use a CXF JAXRS server in a Camel route (using 
camel-cxf).

Regards
JB

On 08/30/2011 01:58 PM, Jon Anstey wrote:
> You can implement REST manually in Camel like
> http://www.andrejkoelewijn.com/wp/2010/06/13/a-composite-rest-service-using-camel/or
> you can use the standard JAX-RS way with the CXFRS component
> http://camel.apache.org/cxfrs.html - both of these links contains lots of
> code samples.
>
> On Tue, Aug 30, 2011 at 4:27 AM, pranay6723<pr...@gmail.com>  wrote:
>
>> Hi,
>> I want to create a simple REST web service  using camel spring and
>> servicemix.. can anybody post a sample code..
>> I am a newbie to servicemix
>>
>> Thanks in advance,
>> Pranay
>>
>> --
>> View this message in context:
>> http://servicemix.396122.n5.nabble.com/Creating-a-simple-REST-web-service-using-servicemix-camel-tp4749070p4749070.html
>> Sent from the ServiceMix - Dev mailing list archive at Nabble.com.
>>
>
>
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Creating a simple REST web service using servicemix camel

Posted by Jon Anstey <ja...@gmail.com>.
You can implement REST manually in Camel like
http://www.andrejkoelewijn.com/wp/2010/06/13/a-composite-rest-service-using-camel/or
you can use the standard JAX-RS way with the CXFRS component
http://camel.apache.org/cxfrs.html - both of these links contains lots of
code samples.

On Tue, Aug 30, 2011 at 4:27 AM, pranay6723 <pr...@gmail.com> wrote:

> Hi,
> I want to create a simple REST web service  using camel spring and
> servicemix.. can anybody post a sample code..
> I am a newbie to servicemix
>
> Thanks in advance,
> Pranay
>
> --
> View this message in context:
> http://servicemix.396122.n5.nabble.com/Creating-a-simple-REST-web-service-using-servicemix-camel-tp4749070p4749070.html
> Sent from the ServiceMix - Dev mailing list archive at Nabble.com.
>



-- 
Cheers,
Jon
---------------
FuseSource
Email: jon@fusesource.com
Web: fusesource.com
Twitter: jon_anstey
Blog: http://janstey.blogspot.com
Author of Camel in Action: http://manning.com/ibsen