Plugins You can find out about all the publicly available Grails plugins.

XFire plugin

  • Tags: /
  • Latest: 0.8.3
  • Last Updated: 26 December 2010
  • Grails version: *
  • Authors: Chanwit Kaewkasi
8 votes
compile "org.grails.plugins:xfire:0.8.3"



This is an XFire plugin for Grails. This plugin allows you to expose Web services using Grails' service classes.

Main contributor: Chanwit Kaewkasi (chanwit At gmail Dot com)

Latest plugin version is 0.8.1.


Type this command in your Grail application directory

$> grails install-plugin xfire

or if you have a plugin archive locally.

$> grails install-plugin /path/to/


This snapshot includes some dependency jar file. If it cannot run out-of-the box, please report in the Grails user group.

Getting Started

This plugin detects the static property 'expose' of a service class. If the 'expose' property contains 'xfire' keyword, then the plugin exposes the service as a Web service.

For example, type this:

$> grails create-service Test
You will get "TestService.groovy" in your service directory. Then, declare the static property "expose" and you may have some methods like: You may declare some method like:
class TestService {

static expose=['xfire']

boolean serviceMethod(YourDomainClass dc){ return true; }

MyPOGO otherServiceMethod(@WebParam(name="token", header=true)UserToken token, MyOtherPOGO obj) { // do something here }


In the above example WebParam is the standard javax.jws.WebParam annotation. In order to use this you will need groovy 1.1 or later and to add an import statement at the top of the source file.

After running the command "grails run-app", you can access the WSDL of this example from

Please note that TestService.groovy becomes 'test' in WSDL.


  • Do not use def as returntypes of methods: it will generate xsd:anyType in the WSDL - specify your return type!
  • To avoid circular referencing, which may cause stack overflow, you have to specify the following in your domain classes (as of version 0.8.1):
static xmlTransients = ['<property name>',...]

Example of avoiding circular references:

class Author {

static hasMany = [books: Book]

String name }

class Book {

static xmlTransients = ['author']

String name Author author }

Upgrade to Grails 1.0.4

Content Negotiation for xml has to be switched off by removing the "xml" mime-type mapping from the grails.mime.types configuration option in Config.groovy. See

Upgrade to Grails 0.6

The name of the plugin has changed from the earlier version to 0.6.1 from XFire to Xfire. Grails gets confused by that, so simply installing the new version is not sufficient, you also have to delete the previous version manually from ./plugins

Upgrade to Grails 0.5(URL Mapping)

It starts to use URL mapping since grails 0.5, the grails project's XxxUrlMapping.groovy and the URL mappings of plugins, that provide their own mapping, has to be modified as blow:

static mappings = {
        constraints {

Version History

v. 0.8.1
  • added detection of 'static xmlTransients' in Domain classes to exclude association properties that may cause circular referencing.
  • fixed jar linkage conflicts.
v. 0.8
  • upgraded for Grails 1.1
  • fixed POGO containing generic fields
v. 0.7.3
  • tested against Grails 1.0
  • GRAILSPLUGINS-222 - Regenerate XfireGrailsPlugin*.class when service class is modified
  • GRAILSPLUGINS-229 - Reloading when name or namespace of the service class is changed
  • GRAILSPLUGINS-232 - Exceptions thrown by xfire service methods always returned as java.lang.reflect.UndeclaredThrowableException
v. 0.7.2
  • GRAILSPLUGINS-217 - Support Generics
  • GRAILSPLUGINS-219 - Allow to customize generated targetNamespace via @WebService
  • minor bugs fixed
v. 0.7.1
  • tested against Grails 1.0-RC4
v. 0.6.x
  • tested against Grails 0.6
v. 0.5.1
  • tested against Grails 0.5.6
  • support the WebParam annotation via Groovy 1.1
  • added POGO serialization support (beside Grails domain classes)
v. 0.5
  • updated to use the new Artefact API
  • tested against Grails 0.5
  • updated XFire to 1.2.6
v. 0.4
  • test against Grails 0.4
v. 0.4-M4
  • fixed detection of the transactional property (again)
  • improved skipping of all "Groovy" properties
  • skipped a java.lang.Boolean property (with "get" prefix !)
v. 0.4-M3
  • changed convention (using "static expose=['xfire']" instead of the "XFireService" suffix)
  • changed URI (now it's for "TestService.groovy")
  • the jar name is going to be SNAPSHOT until Grails 0.4 released.
v. 0.4-M2
  • updated XFire to 1.2.4
  • fixed detection of the transactional property
  • fixed detection of "metaMethods"
  • refactored
v. 0.4-M1
  • added support for Grails domain classes
  • changed the version number to be compatible with Grails
  • first public release
v. 0.1
  • initial