Thanks for all the replies on this... here is the aftermath:
1. Groovy as a service layer
Groovy has exceeded my expectations as an Axis2 service class. For
those not familiar, your service class is basically a Pojo that gets
invoked by Axis2 to respond to requests. There seem to be two general
options for service classes a) take an XML document as a parameter and
produce an XML document as a result type ("document style"), and b)
take Java reference types as method parameters and return a String
("RPC style"). You can configure it to do anything in between also,
but it seems these are the common scenarios.
Anyway, for the document style service, Groovy clearly is better than
Java for parsing and generating tree structures. It is just a lot less
code when you use Groovy. Plus, it is much easier to unit test. For
the RPC style interface, Groovy helped a lot with moving the Java
reference types (think Integer IDs) into entity objects thru the DAO
layer. It's just less code.
2. Axis2 Tools
wsdl2Java is a great tool to point at a WSDL and generate reams of
framework code and a single "MyService.java" pojo that will be your
service class. At this point, I would take MyService.java and rename
it MyService.groovy and away you go! Nothing about using Groovy has
made any of the Axis2 tools break. Axis2 is instantiating your service
class using reflection, so as long as you produce a class file with
the correct public method, then you're good to go. Scala services
should work just fine too, as well as JRuby (I'm guessing). HOWEVER!
The default "MessageHandlers" in Axis2 invoke your service method
using reflection. This means your sweet metaprogramming "invokeMethod"
tricks will not work. That took me a while to figure out.
3. REST vs. SOAP
Axis2 support for REST is not so good. Under the covers, the REST
endpoint is being converted into a SOAP envelope for you. So your
"MessageReceiver" always sees a SOAP message, even when you're using
REST. Also, as Justin stated, only POST and GET work. After looking
breifly at Grails url mapping and REST support, I would encourage
someone to use Grails instead of Axis2. We don't always have the
authority to make these decisions though.
4. Mixing Groovy and Java classes
I never understood the Groovy Joint Compiler until now... My project
has Groovy classes that reference Java classes and Java classes that
reference Groovy classes. The joint compiler runs through the Groovy
code and generates Java stubs for all your Groovy classes. Then it
compiles the Java classes against the stubs so that Java has something
to link to. Lastly, it compiles the Groovy code into real classes and
replaces the stubs. Nifty.
I felt that Groovy's optional static type system really helped Groovy
classes into a Java codebase. My goal was to write Groovy based
service classes and leave the rest in Java. As my Groovy classes grew,
and code started being refactored into reused components, I started
tightening down the contract of the shared code to make it more
usable. On some classes I even eventually stripped out the Groovy
specific libraries and converted them into pure Java classes. It was
great that I could have the thought, "Oh, I really should have written
this in Java" and then actually convert the thing to Java within a few
minutes. Mixing the two was really easy, and context switching between
the two was trivial. Although, by and large, my more common thought
was, "I wish I could just do this in Groovy" rather than vice versa.
But as I said, we don't always have the authority to make these
decisions.
Thanks for the help everyone!
On May 8, 2:54 pm, "Justin Grammens" <
jus...@localtone.com> wrote:
> I did a few WebServices for a client some months back and weighed the
> options of Axis, Axis2 along with REST based approaches (RESTtlet). I
> definitely prefer the simplicity of REST, but you'll need to decide what is
> required by the environment you deploy in. In my case there were a number of
> SOAP authentication headers that were required by the organization, SAML
> tokens, and in addition the client was in .NET and generation of C# code
> based on a WSDL is drop dead easy. I found that the REST interface that
> Axis2 gives you works for simple 'get' and 'post', but didn't seem like
> there was much there for the other methods. It definitely seemed to be,
> "hey, everyone else is doing REST, why not make our SOAP based URL's,
> RESTlike." RESTlet might be something to consider.
>