wood burning stoves 2.0*
The moose likes Groovy and the fly likes Groovy, Web Services and EJBs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Groovy
Bookmark "Groovy, Web Services and EJBs" Watch "Groovy, Web Services and EJBs" New topic
Author

Groovy, Web Services and EJBs

Steve Wink
Ranch Hand

Joined: May 13, 2002
Posts: 223
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?
S Davis
Author
Ranch Hand

Joined: Feb 07, 2006
Posts: 40
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.
Liz Ardu
Greenhorn

Joined: Feb 20, 2008
Posts: 7
codehaus has a nice writeup on Groovy SOAP. I've used this to take legacy Java code and turn it into a web service in just minutes.

http://docs.codehaus.org/display/GROOVY/Groovy+SOAP

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?

You can get the groovy soap jar here
http://momupload.com/files/77499/groovysoap-all-1.0-0.3-snapshot_jdk1.5.0.jar.html
Steve Wink
Ranch Hand

Joined: May 13, 2002
Posts: 223
Thanks, thats helpful.
Liz Ardu
Greenhorn

Joined: Feb 20, 2008
Posts: 7
I don't know how I missed this before but there's a new groovy module: GroovyWS

http://docs.codehaus.org/display/GROOVY/GroovyWS

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Groovy, Web Services and EJBs
 
Similar Threads
Session maintain when using EJB end point
Enterprise Development with Groovy
Comparison between JBoss5.0.0.GA and Tomcat-6.0.18
Spring 3 in distributed environment
using EJB in web services