Saturday, January 20, 2007

XFire plugin changed convention and upgraded to XFire 1.2.4

I've patched the XFire plugin to 1.2.4 and changed some convention to be more compatible with Grails.
Now you can just tweak your Grails services to be Web services by adding the static property 'expose'.
Here's an example:

class TestService {

static expose=['xfire']

def String doSomething(DomainClass dc) {
return "done"
}

def String getData() {
return "data"
}

def void setSomething(String something) {
// set some values here
}
}


The current build is going to skip all properties in a service, including transactional.
However, it's smart enough to expose some methods like 'getData' or void 'setSomething' correctly.
The policy used to expose methods in this build will detect existence of both "getter" and "setter" for a property.
Because in Groovy and Grails, we usually have property by simply defining a property with the 'def' keyword.

BTW, I was trying to compile it using JDK 1.4 but nothing works.
Some type casting exception has been occurred inside XFireSpringServlet and I cannot fix it yet.
So please stay tuned if you're going to use this plugin with Grails on 1.4 VM.

No comments: