You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by je...@hardlight.com.au on 2008/10/13 21:10:08 UTC

is it possible to use CXF without annotations?

Hi, I am using java 1.6 in a mule 2.x project, and need soap support.
I'd like to use cxf, but it seems that its an 'annotations only' technology -
(is this true?)
The classes I am using are shared amongst other projects and I do not want to
annotate them unnecessarily, I'd MUCH prefer to simply configure with an
external xml config file if its an option. I'd also like not to have to create
annotated facades just to support cxf.
is this possible?

Thanks
Jason

Re: is it possible to use CXF without annotations?

Posted by ja...@hardlight.com.au.
fair point!
I think i still prefer if at all possible to avoid them anyway. after all, if I
have a class that is claiming to be a webservice via annotations but it isnt a
webservice in every case - eg:

@SOAPBinding(style=SOAPBinding.Style.DOCUMENT,
             use=SOAPBinding.Use.LITERAL,
             parameterStyle=SOAPBinding.ParameterStyle.BARE)
@WebService
...

then life just gets extremely confusing, I have to realise that jars & configs
exist or not and somehow know to ignore/or not these annotations when reading
the source.
And should I need to support multiple binding variants for various projects at
some point then I'm going to be in trouble.

The more I think about it, the less I think I like annotations generally for all
but the simplest applications. - anyway, this wasnt supposed to be a discussion
on the merits of annotations, just trying to figure out how to use cxf with
mule2.x without them.

thank you for the insight though.
Cheers
Jason.

Quoting Ian Roberts <i....@dcs.shef.ac.uk>:

> jason@hardlight.com.au wrote:
> >    I have no idea how these classes may be used in the future, nor what
> > transports may carry them, my main point was that these classes are often
> used
> > where cxf is just irrelevant, so adding the annotations and the associated
> > dependencies just seems mad.
> 
> Just an aside - you say you're deploying on Java 6, which means you
> don't have any dependency on CXF jar files.  All the annotations you
> need to make JAX-WS work are in javax.jws and
> javax.xml.ws/javax.xml.bind, which are included in the Java 6 core.
> 
> Ian
> 
> -- 
> Ian Roberts               | Department of Computer Science
> i.roberts@dcs.shef.ac.uk  | University of Sheffield, UK
> 




Re: is it possible to use CXF without annotations?

Posted by Ian Roberts <i....@dcs.shef.ac.uk>.
jason@hardlight.com.au wrote:
>    I have no idea how these classes may be used in the future, nor what
> transports may carry them, my main point was that these classes are often used
> where cxf is just irrelevant, so adding the annotations and the associated
> dependencies just seems mad.

Just an aside - you say you're deploying on Java 6, which means you
don't have any dependency on CXF jar files.  All the annotations you
need to make JAX-WS work are in javax.jws and
javax.xml.ws/javax.xml.bind, which are included in the Java 6 core.

Ian

-- 
Ian Roberts               | Department of Computer Science
i.roberts@dcs.shef.ac.uk  | University of Sheffield, UK

Re: is it possible to use CXF without annotations?

Posted by ja...@hardlight.com.au.
hi, and thanks for the prompt resonse!
I generally agree with you, 
although I think you misunderstood my objective in this case. I am not creating
multiple web services, just the one for now, however these classes are used in
other non-web service capacities. sometimes exposed as spring rmi services, and
sometimes not a serialised service at all.
   I have no idea how these classes may be used in the future, nor what
transports may carry them, my main point was that these classes are often used
where cxf is just irrelevant, so adding the annotations and the associated
dependencies just seems mad. Should I someday want to support more web services,
It would be nice to be able to support both xfire and cxf and anything else I
need, and to that end, endlessly modifying annotations in source code doesn't
sit well with me. I much prefer to be able to take an interface and
implementation and say, now be a serviceTypeX without ever recompiling, it means
my clients can do the same thing with my apps too.

at any rate you indicated that you think I can use " simple front end together
with the aegis binding". Examples seem a bit thin on the ground, but thanks for
pointing me in a promising direction.

Cheers
Jason.


Quoting Christian Schneider <ch...@die-schneider.net>:

> Hi Jason,
> 
> if you are planning to create a webservice for several other projects I 
> would recommend doing contract first. If you share your actual java 
> classes between several projects you will get into trouble sooner or 
> later. We have tried this aproach in a SOA project and had problems with 
> this aproach.
> 
> You should always keep in mind that the soap xml that the service 
> framework creates from the same set of java classes may differ between 
> frameworks and beween different versions of the same framework. We had 
> the problem when we changed from xfire to cxf. The same classes produced 
> slighty different xml on the wire. So we could neither introduce cxf on 
> the clients nor on the server spearately. We would have to exchange the 
> version on all servers and clients at the same time. As you can imagine 
> this is not prossible in any larger setup.
> 
> To answer your question. I think you can live without annotations when 
> you use the simple front end together with the aegis binding. But the 
> problems I described above will sooner or later hit you.
> 
> There is only one use case where I favour true code first: If you are 
> simply doing remoting betwen a client and a server that belong to the 
> same release unit. In this case you can make sure that when you roll out 
> a release you will do so on client and server at the same time.
> 
> I have written an article on how to do contract first and still keep 
> much of the advantages of code first:
>
http://cwiki.apache.org/CXF20DOC/defining-contract-first-webservices-with-wsdl-generation-from-java.html
> 
> Greetings
> 
> Christian
> 
> jeacott@hardlight.com.au schrieb:
> > Hi, I am using java 1.6 in a mule 2.x project, and need soap support.
> > I'd like to use cxf, but it seems that its an 'annotations only' technology
> -
> > (is this true?)
> > The classes I am using are shared amongst other projects and I do not want
> to
> > annotate them unnecessarily, I'd MUCH prefer to simply configure with an
> > external xml config file if its an option. I'd also like not to have to
> create
> > annotated facades just to support cxf.
> > is this possible?
> >
> > Thanks
> > Jason
> >
> >   
> 
> 
> -- 
> 
> Christian Schneider
> ---
> http://www.liquid-reality.de
> 
> 




Re: is it possible to use CXF without annotations?

Posted by Christian Schneider <ch...@die-schneider.net>.
Hi Jason,

if you are planning to create a webservice for several other projects I 
would recommend doing contract first. If you share your actual java 
classes between several projects you will get into trouble sooner or 
later. We have tried this aproach in a SOA project and had problems with 
this aproach.

You should always keep in mind that the soap xml that the service 
framework creates from the same set of java classes may differ between 
frameworks and beween different versions of the same framework. We had 
the problem when we changed from xfire to cxf. The same classes produced 
slighty different xml on the wire. So we could neither introduce cxf on 
the clients nor on the server spearately. We would have to exchange the 
version on all servers and clients at the same time. As you can imagine 
this is not prossible in any larger setup.

To answer your question. I think you can live without annotations when 
you use the simple front end together with the aegis binding. But the 
problems I described above will sooner or later hit you.

There is only one use case where I favour true code first: If you are 
simply doing remoting betwen a client and a server that belong to the 
same release unit. In this case you can make sure that when you roll out 
a release you will do so on client and server at the same time.

I have written an article on how to do contract first and still keep 
much of the advantages of code first:
http://cwiki.apache.org/CXF20DOC/defining-contract-first-webservices-with-wsdl-generation-from-java.html

Greetings

Christian

jeacott@hardlight.com.au schrieb:
> Hi, I am using java 1.6 in a mule 2.x project, and need soap support.
> I'd like to use cxf, but it seems that its an 'annotations only' technology -
> (is this true?)
> The classes I am using are shared amongst other projects and I do not want to
> annotate them unnecessarily, I'd MUCH prefer to simply configure with an
> external xml config file if its an option. I'd also like not to have to create
> annotated facades just to support cxf.
> is this possible?
>
> Thanks
> Jason
>
>   


-- 

Christian Schneider
---
http://www.liquid-reality.de