views:

228

answers:

2

I have a web service in Grails, published using the xfire plugin. It's all fine and can be connected to no problem at all. But I'd like to modify the format of the request and response. Is that possible?

The example structure is:

Domain class Person, has many Siblings. Each Sibling has a Child.

My web serice method currently looks something like this:

Person updatePerson(Person person) {
  return Person.getById(person.id)
}

But that produces a WSDL with the format:

Person
   Person fields
       Sibling
           Sibling fields
           Child
       Sibling
            Sibling fields

etc etc.

I don't want to accept the data in this format, or return it in that format. Is there a way of specifying which fields are exposed to the web service and what the WSDL should look like, or is xfire the wrong plugin to use for this?

+1  A: 

I would answer this as its creator. To exclude some domain properties, add:

static xmlTransients = ['your_property_goes_here']

to your domain classes.

However, the plugin does not allow you to control creation of the WSDL directly.

chanwit
A: 

I would recommend looking at the Spring WS plugin. It's designed around "contract-first" web service development, so you have complete control over the resulting WSDL. The Xfire, Axis and Metro plugins are all great, but from my experience are all geared towards code-first and don't allow direct control over the resulting interface/output.

John Wagenleitner