Recently, I have been working on annotation support for XFire, the light-weight, next-gen, Axis-less Java SOAP framework. Basically, what we are aiming for is that you can use JSR-181-like annotations to export your web service:
package org.codehaus.xfire.annotations.sample; ... @WebService public class EchoService { @WebMethod public String echo(@WebParam(name="name",header=true) String input) { return input; } }
You can see that you no longer need a service interface class to define what methods are exported @WebService annotates the class EchoService and the XFire runtime that it is a web service. @WebMethod annotates the method echo, and tells the runtime that the method can be invoked over the web. Finally, @WebParam tells the runtime that the echo method accepts a parameter, which should be expressed as SOAP header. Note that you no longer need a separate service interface to define the contract of your web service; you do so with annotations.
These are just examples, there are lots more annotations coming. Take a look at JSR-181 if you’re interested.
If everyone was running Java 5, then the above would be nice and dandy. However, some people are three versions behind and stuck on Java 2. Other people already use some sort of annotation framework, and do not want to use two in one project. Thus I decided to offer the annotation for two the most popular old-style annotation frameworks: Commons Attributes, and backport175. (As a matter of fact, these are the only kind of annotations supported at the moment because I’m developing on a Mac, and [Mac OS|Java] Tiger is still a month away).
The Commons Attributes version of the sample above would be very similar:
package org.codehaus.xfire.annotations.sample; ... /** * @@WebService() */ public class CommonsEchoService { /** * @@WebMethod() * @@.input @WebParam(name="name",header=true) */ public String echo(String input) { return input; } }
And everything would work exactly the same as previously!
For you as a XFire user, this means that you can migrate from for instance Commons Attributes to Java 5 with minimal effort. All it should take is changing some imports and moving the annotations out of the Javadoc.
When are you planning to release first alpha/beta snapshots of xfire annotations?
Probably at the the end of March/beginning of April, as part of the M4 release