You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Live Nono <li...@gmail.com> on 2009/08/13 14:38:05 UTC

Design questions CXF//my need

hi

I'm currently looking at CXF for the needs I have here and I'm having
difficulties to figure out whether it fits. Hopefully some on the ML
could help me (thanks in advance!).

My "ideal" world needs are :
- defining the service in Java through annotations
- publishing it both through some Web Service and REST
- feeding the service with my own Guice managed objects
- making it available through my own web application (namely a wicket one)
- having some documentation (not only the WSDL but as well some docs
based on the written Javadoc) automatically generated in a way that
makes it easy to provide to my service's users
- integration with maven and m2eclipse (ability to launch my web
service as a Java embedded app from eclipse would be a bonus)

Is it possible ? Could you give links/helps/tips ?

Up to now, I found that it was possible to create a web application
delivering Web Service or REST (but both I've no clue) and the others
questions remain unresolved.

Thanks in advance
nono

Re: Design questions CXF//my need

Posted by Andrew Clegg <an...@nervechannel.com>.
I'm not sure about some of your questions as I've only worked in
WSDL-first SOAP services. I'm sure others can help with these though.

2009/8/13 Live Nono <li...@gmail.com>:

> - feeding the service with my own Guice managed objects

Yes. There's no direct integration (CXF uses Spring for DI, not
Guice), but you can create an Injector in your service implementation
object's constructor and then do an injectMembers( this ) or whatever
to bring up the rest of your object graph.

Or you could try it via the Spring/Guice integration approach:

http://www.jroller.com/mindcrime/entry/an_example_of_integrating_guice

> - making it available through my own web application (namely a wicket one)

Not sure what you mean here -- do you want a single web app to contain
wicket stuff and CXF stuff? It's probably more flexible to build them
into separate WARs that you can deploy alongside each other. But it
may be possible to do this (anyone?).

> - integration with maven and m2eclipse

Yes, this works very well.

> (ability to launch my web
> service as a Java embedded app from eclipse would be a bonus)

Umm, not sure...

Andrew.

-- 
:: http://biotext.org.uk/ ::

Re: Design questions CXF//my need

Posted by Gabo Manuel <km...@solegysystems.com>.
Hi Nono,

Filters, providers, dispatch... that could get pretty advanced. I am 
currently sticking to just the basic annotations until I could 
thoroughly get the experience I need. The following should enable you to 
create the basics that you need:

For the ReST part: 
http://cwiki.apache.org/CXF20DOC/jax-rs.html#JAX-RS-Understandingthebasics
For the SOAP part: 
http://cwiki.apache.org/CXF20DOC/developing-a-service.html#DevelopingaService-JavaFirstDevelopment

Note that this is java-first development. I believe this would be the 
easier way of having both in just one implementation class. Preferably 
though, you would have most of the annotations in your interface.

If you prefer wsdl-first (or wadl-first for rest), I believe there is 
also a section on that as well.

Hope this helps.

Gabo

Live Nono wrote:
> ok, I'm gonna try that again, I obviously missed something. Then the
> blog entry is speaking of filters which can of afraid me :$
>
> thanks again, digging in :)
>
> ++
>
> 2009/8/14 Gabo Manuel <km...@solegysystems.com>:
>   
>> Hi Nono,
>>
>>     
>>> is there some documentation around on how to do them both together ?
>>> The only thing close to it I found is this blog entry :
>>> http://sberyozkin.blogspot.com/2008/07/rest-and-soap-united-in-cxf.html
>>> which makes it seems not straightforward.
>>>
>>>       
>> I am not sure how it is not as straightforward as it could get. But to get
>> you jump started, basically just combine/overlap the jax-rs and jax-ws tags
>> in your service interface. If you use annotation, then you could just do
>> something of the following:
>>
>> @WebService(name="Service")
>> @SOAPBinding(use=Use.LITERAL, style=Style.RPC)
>> @Consumes("*/*")
>> @Produces("text/xml")
>> @Path("/ServicePath")
>> public interface Service
>>   @PUT
>>   @Path("/Some/Additional/Path/")
>>   @WebMethod
>>   @WebResult(name="resultName")
>>   public long method(
>>           @QueryParam("someParam")
>>           @WebParam(name="someParam")
>>           long someParam
>>           )
>>
>> and in the implementation:
>>
>> @WebService(endpointInterface="some.domain.Service", serviceName="Service",
>> portName="ServicePort")
>> public class ServiceImpl implements Service{
>>
>> Simply, just combine the annotations of Jax-rs and jax-ws as specified in
>> the user's guide.
>>
>> Hth.
>>
>> Gabo
>>     
> >
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com 
> Version: 8.5.392 / Virus Database: 270.13.53/2299 - Release Date: 08/12/09 18:12:00
>
>   

Re: Design questions CXF//my need

Posted by Live Nono <li...@gmail.com>.
ok, I'm gonna try that again, I obviously missed something. Then the
blog entry is speaking of filters which can of afraid me :$

thanks again, digging in :)

++

2009/8/14 Gabo Manuel <km...@solegysystems.com>:
> Hi Nono,
>
>> is there some documentation around on how to do them both together ?
>> The only thing close to it I found is this blog entry :
>> http://sberyozkin.blogspot.com/2008/07/rest-and-soap-united-in-cxf.html
>> which makes it seems not straightforward.
>>
>
> I am not sure how it is not as straightforward as it could get. But to get
> you jump started, basically just combine/overlap the jax-rs and jax-ws tags
> in your service interface. If you use annotation, then you could just do
> something of the following:
>
> @WebService(name="Service")
> @SOAPBinding(use=Use.LITERAL, style=Style.RPC)
> @Consumes("*/*")
> @Produces("text/xml")
> @Path("/ServicePath")
> public interface Service
>   @PUT
>   @Path("/Some/Additional/Path/")
>   @WebMethod
>   @WebResult(name="resultName")
>   public long method(
>           @QueryParam("someParam")
>           @WebParam(name="someParam")
>           long someParam
>           )
>
> and in the implementation:
>
> @WebService(endpointInterface="some.domain.Service", serviceName="Service",
> portName="ServicePort")
> public class ServiceImpl implements Service{
>
> Simply, just combine the annotations of Jax-rs and jax-ws as specified in
> the user's guide.
>
> Hth.
>
> Gabo
>

Re: Design questions CXF//my need

Posted by Gabo Manuel <km...@solegysystems.com>.
Hi Nono,

> is there some documentation around on how to do them both together ?
> The only thing close to it I found is this blog entry :
> http://sberyozkin.blogspot.com/2008/07/rest-and-soap-united-in-cxf.html
> which makes it seems not straightforward.
>   
I am not sure how it is not as straightforward as it could get. But to 
get you jump started, basically just combine/overlap the jax-rs and 
jax-ws tags in your service interface. If you use annotation, then you 
could just do something of the following:

@WebService(name="Service")
@SOAPBinding(use=Use.LITERAL, style=Style.RPC)
@Consumes("*/*")
@Produces("text/xml")
@Path("/ServicePath")
public interface Service
    @PUT
    @Path("/Some/Additional/Path/")
    @WebMethod
    @WebResult(name="resultName")
    public long method(
            @QueryParam("someParam")
            @WebParam(name="someParam")
            long someParam
            )

and in the implementation:

@WebService(endpointInterface="some.domain.Service", 
serviceName="Service", portName="ServicePort")
public class ServiceImpl implements Service{

Simply, just combine the annotations of Jax-rs and jax-ws as specified 
in the user's guide.

Hth.

Gabo

Re: Design questions CXF//my need

Posted by Live Nono <li...@gmail.com>.
Hi

Thanks a lot for all your answers :)

Regarding this bit :

>This is definitely one of the strong points for CXF compared to some of the
>others.   CXF implements both JAX-WS and JAX-RS and provides good support to
>allow implementations to support both SOAP style interactions and REST style.

is there some documentation around on how to do them both together ?
The only thing close to it I found is this blog entry :
http://sberyozkin.blogspot.com/2008/07/rest-and-soap-united-in-cxf.html
which makes it seems not straightforward.


> As mentioned above, with 2.3, there will be a new set of annotations to expand
> the wsdl:documentation tags in the generated WSDL.

Great :)

thanks again !

nono

Re: Design questions CXF//my need

Posted by Daniel Kulp <dk...@apache.org>.
On Thu August 13 2009 8:38:05 am Live Nono wrote:
> hi
>
> I'm currently looking at CXF for the needs I have here and I'm having
> difficulties to figure out whether it fits. Hopefully some on the ML
> could help me (thanks in advance!).
>
> My "ideal" world needs are :
> - defining the service in Java through annotations

Definitely.   JAX-WS definitely defines a lot around how to do this.   With 
the upcoming CXF 2.3 version, we're going to be taking this even further by 
adding custom annotations for a lot of things that are either not possible 
with straight JAX-WS/config things (like adding documentation to the generated 
wsdl), or require more complex configuration (to turn on things like 
fastinfoset support, schema validation, etc...).   

> - publishing it both through some Web Service and REST

This is definitely one of the strong points for CXF compared to some of the 
others.   CXF implements both JAX-WS and JAX-RS and provides good support to 
allow implementations to support both SOAP style interactions and REST style. 

> - feeding the service with my own Guice managed objects

I honestly don't know enough about Guice to answer this.   In general, we use 
Spring.   

> - making it available through my own web application (namely a wicket one)

The CXF services would just be an additional service in you web.xml, thus, 
they should work find together.

> - having some documentation (not only the WSDL but as well some docs
> based on the written Javadoc) automatically generated in a way that
> makes it easy to provide to my service's users

As mentioned above, with 2.3, there will be a new set of annotations to expand 
the wsdl:documentation tags in the generated WSDL.   

> - integration with maven and m2eclipse (ability to launch my web
> service as a Java embedded app from eclipse would be a bonus)

Yep.   We like maven.   :-)

If you use a maven "war" packaging, it should wire into wtp fairly 
automatically which would allow it to launch in eclipse.    That said, it's 
also very easy to create a quick "main" method to start any service (or in 
your setUp method for a unit test or similar).

Dan



> Is it possible ? Could you give links/helps/tips ?
>
> Up to now, I found that it was possible to create a web application
> delivering Web Service or REST (but both I've no clue) and the others
> questions remain unresolved.
>
> Thanks in advance
> nono

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog