Grails Domain Objects Over Webservices

groovy.lang.MetaClass is an interface, and JAXB can’t handle interfaces

Nope. Sure can’t. And that sucks. But how do I get my Grails domain objects to pass over web services.

I’m SOOOO happy I finally figured this out. It made our web services almost unreadable and unusable.

Anyway, if you are struggling with this, my solution is to use the XML annotation @XmlAccessorType(XmlAccessType.FIELD) in the domain class. This will limit JAXB’s exploration of the object to only the declared members. Awesome.

(remember to “import javax.xml.bind.annotation.*;”)



Tags: , , , ,
This entry was posted on Monday, July 20th, 2009 at 8:33 am and is filed under Uncategorized. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply

Your comment