You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Sperner, Klaus" <kl...@sap.com> on 2011/08/07 19:24:34 UTC
Tutorial for creation of RESTful interface with CXF?
Dear CXF Users,
I'm trying to develop a RESTful interface (JAX-RS) using Apache CXF, and I'd like to deploy it into a Tomcat Server from the Eclipse IDE. I found this tutorial (http://pettergraff.blogspot.com/2010/11/developing-web-service-in-eclipse.html), which describes the needed steps for a normal Web service (JAX-WS) very detailed, but I didn't find any tutorials for the creation of RESTful interfaces. Is there such a tutorial around, or could you provide me with a short sequence of the necessary steps to accomplish the deployment of the server and client side components. As I don't know much about Maven and nothing about Spring, I'd like to omit these technologies in the first step, but if I need them, or if they make it much easier, I'll have a closer look at them.
Any help would be appreciated.
Thanks in advance and best regards,
Klaus
Klaus Sperner
Research Associate
SAP (Switzerland) Inc., Kreuzplatz 20, 8008 Zurich, Switzerland
T +41 58 871 78 31, M +41 76 409 40 63, F +41 58 871 78 12
mailto:klaus.sperner@sap.com
Please consider the impact on the environment before printing this e-mail.
Re: Tutorial for creation of RESTful interface with CXF?
Posted by Ron Wheeler <rw...@artifact-software.com>.
On 08/08/2011 9:20 AM, Glen Mazza wrote:
> The effort spent learning Maven will pay off rather quickly, and also
> web services--REST or SOAP--are an easy, pleasant way to quickly get
> up to speed with this fine build tool. CXF services are also an easy
> way to learn more about Spring--but Spring knowledge is not that
> important, it ultimately is just Java code, we just happen to use
> Spring instead of reinventing the wheel.
>
Spring may not be essential for using CXF but is a very worthwhile tool
to have and really reduces the effort required to build robust applications.
> The Talend JAX-RS Advanced example explained here:
> http://www.jroller.com/gmazza/entry/video_tsf_jaxrs_advanced_example,
> is fully Mavenized (has an architecture you can copy for your own
> work) and has an ability to be deployed on standalone Tomcat (even
> though the video uses OSGi deployment instead) -- just check the
> README of that sample for Tomcat deployment.
>
> I'd recommend my WSDL first tutorial
> (http://www.jroller.com/gmazza/entry/web_service_tutorial) not so much
> for learning about SOAP but just a quick way to get up to speed with
> Maven: building projects with it (mvn clean install) and deploying to
> Tomcat (mvn tomcat:redeploy). Eclipse should just be for coding, if
> you use it for project building and servlet container deployment it
> will slow you down over time.
Eclipse STS is a fully integrated version of Eclipse and gives you
everything that you need for CXF.
It makes installing and maintaining the right Eclipse tool kit very simple.
Instead of taking a whole day to upgrade or install Eclipse, it is a
simple install that takes 1/2 an hour to get everything all set up with
the right versions of all the plug-ins that you need to develop web
services.
Ron
>
> HTH,
> Glen
>
> On 8/7/2011 1:24 PM, Sperner, Klaus wrote:
>> Dear CXF Users,
>>
>> I'm trying to develop a RESTful interface (JAX-RS) using Apache CXF,
>> and I'd like to deploy it into a Tomcat Server from the Eclipse IDE.
>> I found this tutorial
>> (http://pettergraff.blogspot.com/2010/11/developing-web-service-in-eclipse.html),
>> which describes the needed steps for a normal Web service (JAX-WS)
>> very detailed, but I didn't find any tutorials for the creation of
>> RESTful interfaces. Is there such a tutorial around, or could you
>> provide me with a short sequence of the necessary steps to accomplish
>> the deployment of the server and client side components. As I don't
>> know much about Maven and nothing about Spring, I'd like to omit
>> these technologies in the first step, but if I need them, or if they
>> make it much easier, I'll have a closer look at them.
>>
>> Any help would be appreciated.
>> Thanks in advance and best regards,
>> Klaus
>>
>> Klaus Sperner
>> Research Associate
>> SAP (Switzerland) Inc., Kreuzplatz 20, 8008 Zurich, Switzerland
>>
>> T +41 58 871 78 31, M +41 76 409 40 63, F +41 58 871 78 12
>> mailto:klaus.sperner@sap.com
>>
>> Please consider the impact on the environment before printing this
>> e-mail.
>>
>>
>>
>
>
Re: Tutorial for creation of RESTful interface with CXF?
Posted by Glen Mazza <gm...@talend.com>.
The effort spent learning Maven will pay off rather quickly, and also
web services--REST or SOAP--are an easy, pleasant way to quickly get up
to speed with this fine build tool. CXF services are also an easy way
to learn more about Spring--but Spring knowledge is not that important,
it ultimately is just Java code, we just happen to use Spring instead of
reinventing the wheel.
The Talend JAX-RS Advanced example explained here:
http://www.jroller.com/gmazza/entry/video_tsf_jaxrs_advanced_example, is
fully Mavenized (has an architecture you can copy for your own work) and
has an ability to be deployed on standalone Tomcat (even though the
video uses OSGi deployment instead) -- just check the README of that
sample for Tomcat deployment.
I'd recommend my WSDL first tutorial
(http://www.jroller.com/gmazza/entry/web_service_tutorial) not so much
for learning about SOAP but just a quick way to get up to speed with
Maven: building projects with it (mvn clean install) and deploying to
Tomcat (mvn tomcat:redeploy). Eclipse should just be for coding, if you
use it for project building and servlet container deployment it will
slow you down over time.
HTH,
Glen
On 8/7/2011 1:24 PM, Sperner, Klaus wrote:
> Dear CXF Users,
>
> I'm trying to develop a RESTful interface (JAX-RS) using Apache CXF, and I'd like to deploy it into a Tomcat Server from the Eclipse IDE. I found this tutorial (http://pettergraff.blogspot.com/2010/11/developing-web-service-in-eclipse.html), which describes the needed steps for a normal Web service (JAX-WS) very detailed, but I didn't find any tutorials for the creation of RESTful interfaces. Is there such a tutorial around, or could you provide me with a short sequence of the necessary steps to accomplish the deployment of the server and client side components. As I don't know much about Maven and nothing about Spring, I'd like to omit these technologies in the first step, but if I need them, or if they make it much easier, I'll have a closer look at them.
>
> Any help would be appreciated.
> Thanks in advance and best regards,
> Klaus
>
> Klaus Sperner
> Research Associate
> SAP (Switzerland) Inc., Kreuzplatz 20, 8008 Zurich, Switzerland
>
> T +41 58 871 78 31, M +41 76 409 40 63, F +41 58 871 78 12
> mailto:klaus.sperner@sap.com
>
> Please consider the impact on the environment before printing this e-mail.
>
>
>
--
Glen Mazza
Software Engineer, Talend (http://www.talend.com)
blog: http://www.jroller.com/gmazza
Re: Tutorial for creation of RESTful interface with CXF?
Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On Sun, Aug 7, 2011 at 6:24 PM, Sperner, Klaus <kl...@sap.com> wrote:
> Dear CXF Users,
>
> I'm trying to develop a RESTful interface (JAX-RS) using Apache CXF, and I'd like to deploy it into a Tomcat Server from the Eclipse IDE. I found this tutorial (http://pettergraff.blogspot.com/2010/11/developing-web-service-in-eclipse.html), which describes the needed steps for a normal Web service (JAX-WS) very detailed, but I didn't find any tutorials for the creation of RESTful interfaces. Is there such a tutorial around, or could you provide me with a short sequence of the necessary steps to accomplish the deployment of the server and client side components. As I don't know much about Maven and nothing about Spring, I'd like to omit these technologies in the first step, but if I need them, or if they make it much easier, I'll have a closer look at them.
>
If you prefer starting without Spring then the simplest way to start
is to use CXFNonSpringJaxrsServlet:
http://cxf.apache.org/docs/jaxrs-services-configuration.html#JAXRSServicesConfiguration-ConfiguringJAXRSservicesincontainerwithoutSpring
For example, lets assume you have services.war (built with Ant or in
Eclipse) so the base URI is for example
"http://localhost:8080/services".
Configure the servlet in web.xml, for example:
<servlet>
<servlet-name>CXFServlet</servlet-name>
<display-name>CXF Servlet</display-name>
<servlet-class>
org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet
</servlet-class>
<init-param>
<param-name>jaxrs.serviceClasses</param-name>
<param-value>
org.bar.RootResource
</param-value>
</init-param>
</servlet>
...
Assuming org.bar.RootResource has a class-level @Path("/") and
resource method having @GET and @Path("/bar"), then after deploying
services.war, "GET http://localhost:8080/services/bar" should return
some representation...
http://cxf.apache.org/docs/jax-rs.html#JAX-RS-Settinguptheclasspath
should help re setting up Eclipse classpath if you prefer working from
Eclipse. We've put a lot of effort in improving demos and
documentation in our Talend distributions but I must admit an
Eclipse-based tutorial is missing - we'll look into it :-)
Let us know please how are getting on with the initial setup,
Cheers, Sergey
> Any help would be appreciated.
> Thanks in advance and best regards,
> Klaus
>
> Klaus Sperner
> Research Associate
> SAP (Switzerland) Inc., Kreuzplatz 20, 8008 Zurich, Switzerland
>
> T +41 58 871 78 31, M +41 76 409 40 63, F +41 58 871 78 12
> mailto:klaus.sperner@sap.com
>
> Please consider the impact on the environment before printing this e-mail.
>
>
>
>
--
Sergey Beryozkin
http://sberyozkin.blogspot.com
Talend - http://www.talend.com
Re: Tutorial for creation of RESTful interface with CXF?
Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Klaus
thanks for the update, looks like things are going well :-), more
comments inline
On Mon, Aug 8, 2011 at 4:53 PM, Sperner, Klaus <kl...@sap.com> wrote:
> Dear Antoine, Sergey, Glen, and Ron,
>
> thanks to all of you for responding to my mail. In the meantime I managed to create the server-side of my RESTful interface with CXF on my own, using Maven and Spring, and of course googling many times. I learned quite a lot, especially about Maven, the maven-archetype-webapp, and the tomcat:deploy and redeploy mechanisms. I still have to understand, what Spring is doing for me at the moment, but this will come. Afterwards, I think, that the most annoying obstacle was the missing java source folder in the webapp archetype. So I'm wondering, if it would be a good idea to provide a maven archetype for creating a RESTful interface with Apache CXF. What do you think? If it is of general interest (and if the weather during the weekend is bad), I could provide a detailed howto, showing what I did.
S.B: I think it would be very useful indeed, we've been talking about
providing all sort of Maven archetypes to streamline the dev process,
and having the one facilitating the development of RESTful endpoints
would be nice too IMHO. Please post some details whenever you get a
chance
Thanks, Sergey
Now I'll have a look at the client-side and the common part for client
and server.
>
> Best regards and thanks again,
> Klaus
>
> -----Original Message-----
> From: Sperner, Klaus [mailto:klaus.sperner@sap.com]
> Sent: Sonntag, 7. August 2011 19:25
> To: users@cxf.apache.org
> Subject: Tutorial for creation of RESTful interface with CXF?
>
> Dear CXF Users,
>
> I'm trying to develop a RESTful interface (JAX-RS) using Apache CXF, and I'd like to deploy it into a Tomcat Server from the Eclipse IDE. I found this tutorial (http://pettergraff.blogspot.com/2010/11/developing-web-service-in-eclipse.html), which describes the needed steps for a normal Web service (JAX-WS) very detailed, but I didn't find any tutorials for the creation of RESTful interfaces. Is there such a tutorial around, or could you provide me with a short sequence of the necessary steps to accomplish the deployment of the server and client side components. As I don't know much about Maven and nothing about Spring, I'd like to omit these technologies in the first step, but if I need them, or if they make it much easier, I'll have a closer look at them.
>
>
> Any help would be appreciated.
> Thanks in advance and best regards,
> Klaus
>
> Klaus Sperner
> Research Associate
> SAP (Switzerland) Inc., Kreuzplatz 20, 8008 Zurich, Switzerland
>
> T +41 58 871 78 31, M +41 76 409 40 63, F +41 58 871 78 12
> mailto:klaus.sperner@sap.com
>
> Please consider the impact on the environment before printing this e-mail.
>
>
>
>
--
Sergey Beryozkin
http://sberyozkin.blogspot.com
Talend - http://www.talend.com
RE: Tutorial for creation of RESTful interface with CXF?
Posted by "Sperner, Klaus" <kl...@sap.com>.
Dear Antoine, Sergey, Glen, and Ron,
thanks to all of you for responding to my mail. In the meantime I managed to create the server-side of my RESTful interface with CXF on my own, using Maven and Spring, and of course googling many times. I learned quite a lot, especially about Maven, the maven-archetype-webapp, and the tomcat:deploy and redeploy mechanisms. I still have to understand, what Spring is doing for me at the moment, but this will come. Afterwards, I think, that the most annoying obstacle was the missing java source folder in the webapp archetype. So I'm wondering, if it would be a good idea to provide a maven archetype for creating a RESTful interface with Apache CXF. What do you think? If it is of general interest (and if the weather during the weekend is bad), I could provide a detailed howto, showing what I did. Now I'll have a look at the client-side and the common part for client and server.
Best regards and thanks again,
Klaus
-----Original Message-----
From: Sperner, Klaus [mailto:klaus.sperner@sap.com]
Sent: Sonntag, 7. August 2011 19:25
To: users@cxf.apache.org
Subject: Tutorial for creation of RESTful interface with CXF?
Dear CXF Users,
I'm trying to develop a RESTful interface (JAX-RS) using Apache CXF, and I'd like to deploy it into a Tomcat Server from the Eclipse IDE. I found this tutorial (http://pettergraff.blogspot.com/2010/11/developing-web-service-in-eclipse.html), which describes the needed steps for a normal Web service (JAX-WS) very detailed, but I didn't find any tutorials for the creation of RESTful interfaces. Is there such a tutorial around, or could you provide me with a short sequence of the necessary steps to accomplish the deployment of the server and client side components. As I don't know much about Maven and nothing about Spring, I'd like to omit these technologies in the first step, but if I need them, or if they make it much easier, I'll have a closer look at them.
Any help would be appreciated.
Thanks in advance and best regards,
Klaus
Klaus Sperner
Research Associate
SAP (Switzerland) Inc., Kreuzplatz 20, 8008 Zurich, Switzerland
T +41 58 871 78 31, M +41 76 409 40 63, F +41 58 871 78 12
mailto:klaus.sperner@sap.com
Please consider the impact on the environment before printing this e-mail.
Re: Tutorial for creation of RESTful interface with CXF?
Posted by antoine philippe chaker <ph...@gmail.com>.
Hi Klaus,
What you want to do with CXF is not complicated, but without Spring and
Maven ... I think that you can't.
On the other side, it's a gain for you to know this two technologies as they
are used on many Apache and
many more projects.
Greet
2011/8/7 Sperner, Klaus <kl...@sap.com>
> Dear CXF Users,
>
> I'm trying to develop a RESTful interface (JAX-RS) using Apache CXF, and
> I'd like to deploy it into a Tomcat Server from the Eclipse IDE. I found
> this tutorial (
> http://pettergraff.blogspot.com/2010/11/developing-web-service-in-eclipse.html),
> which describes the needed steps for a normal Web service (JAX-WS) very
> detailed, but I didn't find any tutorials for the creation of RESTful
> interfaces. Is there such a tutorial around, or could you provide me with a
> short sequence of the necessary steps to accomplish the deployment of the
> server and client side components. As I don't know much about Maven and
> nothing about Spring, I'd like to omit these technologies in the first step,
> but if I need them, or if they make it much easier, I'll have a closer look
> at them.
>
> Any help would be appreciated.
> Thanks in advance and best regards,
> Klaus
>
> Klaus Sperner
> Research Associate
> SAP (Switzerland) Inc., Kreuzplatz 20, 8008 Zurich, Switzerland
>
> T +41 58 871 78 31, M +41 76 409 40 63, F +41 58 871 78 12
> mailto:klaus.sperner@sap.com
>
> Please consider the impact on the environment before printing this e-mail.
>
>
>
>
--
*CHAKER Antoine Philippe Chekry*
*Ingénieur en Informatique*
*Développeur Java J2EE **,
<http://www.blackbeltfactory.com/ui#!User/aphilippe>WebMaster*
*CNPS - Cote d'Ivoire*
*
*