How easy would it be to use Groovy to expose Web Services to the outside world , and to implement these services as Groovy scripting, and calls to existing Java POJOs, and EJBs inside an application server (lets say WebSphere.)? Is this a suitable use for Groovy?
If by "Web Services" you mean "SOAP", support is there but it's not mainstream. SOAP is reaching the end of its natural life (Google deprecated its SOAP services in 2006 in favor of REST; Yahoo! has always been RESTful to the best of my knowledge.), and that's reflected in many modern languages.
You'll find great support in Grails for REST and JSON "Web Services". There's an XFire plugin for SOAP, as well as plugins for RSS and Atom. I have an entire chapter dedicated to this broader, more inclusive definition of Web Services.
The good news is Groovy can use any Java library for SOAP, so you are in good shape there. The same is true for calling existing POJOs and EJBs -- Groovy can call Java seamlessly, and Java can call Groovy seamlessly. Groovy classes can implement Java interfaces and vice versa.
Groovy can quite literally do anything that Java can do because it _is_ Java.
But the Groovy SOAP jar link in the writeup is now broken. There's a few comments in the wiki reporting that the link is broke but so far no progress. Does anyone know what's up? Is the latest version of Groovy not compatible with that SOAP jar?
from the page: "GroovyWS is taking over GroovySOAP as CXF replaces XFire. The major difference here is that GroovyWS is using Java5 so if you need to stick to 1.4 please continue to use GroovySOAP."
I attempted to use GroovyWS and immediately encountered an odd error when trying out the simple server example. After staring at the problem and then finally using GWhich (a groovy-fied version of JWhich), I found that with the GroovySOAP jar in the groovy/lib folder, a wrong class is loaded. After removing the SOAP jar, all is well.
I have used XFire before but had never heard of CXF. This Apache incubator project looks pretty cool. The support for RESTful HTTP especially looks interesting to me.
Hug your destiny! And hug this tiny ad:
ScroogeXHTML 8.7 - RTF to HTML5 and XHTML converter