views:

1155

answers:

2

What are the relative strengths and weaknesses between Sun Metro and Apache CXF for webservice development in Java. Is there another framework that I should be looking at as well?

+2  A: 

I was in your position a few months back, and ended up looking closer at Metro.

The killer feature for me was the fact that Metro uses standard annotations to expose a given method as a web service and that all the glue code could be generated automatically at runtime. I.e. no extra steps to make when building and deploying and works in a standard servlet container (2.5 I believe) under Java 5 which is our current deployment platform.

This has worked very well for us.

The reason that I went for the standard annotations is the very simple that our applications tend to live literaly for decades after which some maintainance must be done. By coding to an interface instead of an implementation we may swap out the whole scaffolding underneath the code without changing the code implementing the web service. In ten years time (or more) any specific implementaiton may have withered and died, but other implementaitons may have risen since and be immediately pluggable.

Just see how many choices you have today for a servlet container... Thats the power of a good API!


Edit: Apparently the Java 6 runtime includes the Metro stack plus a minimal web server. In other words, the JRE alone may be the scaffolding replacement mentioned above :D

Thorbjørn Ravn Andersen
+1 for thinking of those poor fools who will have to figure this code out in 10 years time. May be one of us!
Yar
@yar, I was merely hoping that it didn't HAVE to be me :)
Thorbjørn Ravn Andersen
AFAIK, Java 6 doesn't include Metro, it includes JAX-WS RI which is a subset of Metro (Metro = JAX-WS + WSIT/Tango). But yes, with Java 6, you can publish a web service endpoint through the `Endpoint.publish()` method, using the HTTP server embedded in Java SE 6. See http://www.javapassion.com/webservices/jaxwsjavase6.pdf.
Pascal Thivent
I do not claim expert status on this - just what I _think_ I learned :) Do you have practical experience with the Endpoint.publish() method? (And, if I recall correctly the annotation approach goes in JEE 6 or so so it will be standard)
Thorbjørn Ravn Andersen
I've used the `Endpoint.publish()` during development. Just add it in a the main() of a web service and you can start/deploy it easily. This can be very handy. Regarding the JAX-WS standard, it's a part of JEE 5.
Pascal Thivent
CXF is just the same as Metro with respect to the issues discussed in this answer.
bmargulies
It supports @-annotation and generates the scaffolding classes on the fly?
Thorbjørn Ravn Andersen
Yes. CXF is JAX-WS certified and all those annotations are all part of the JAX-WS spec. Code written to JAX-WS spec should work perfectly in CXF or Metro. Power of standard API's and annotations. :-)
Daniel Kulp
+4  A: 

Both Metro and CXF are JAX-WS compliant web service stacks, and from a runtime perspective, there's very little pick between them.

However, CXF has vastly better documentation, and much more flexibility and additional functionality if you're willing to go beyond the JAX-WS specification. On the basis of documentation alone, I'd pick CXF over Metroevery time.

However, I would pick Spring WebServices over either Metro or CXF. It's not JAX-WS-compliant, but I don't consider that to be an issue. It's also both considerably simpler, and considerably more flexible than either of them. Highly recommended.

skaffman
Could you elaborate a bit on the CXF functionality you talk about and the Spring WS ditto?
Thorbjørn Ravn Andersen
The joy of CXF and Spring-WS is that you can go to their websites and read the excellent documentation to see what they can do :)
skaffman
I know - you may have seen that I'd been looking for such a framework. I was thinking in - like - actual experiences and such which you indicated you had and I had this strange notion that perhaps you'd even want to share them... Shame on me.
Thorbjørn Ravn Andersen