• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Groovy, Web Services and EJBs

 
Steve Wink
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, thats helpful.
 
Liz Ardu
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic