Wednesday, May 9, 2012

Grails : Rest Service with JAXB parsing - PART 2

In my last post on Rest Service with JAXB parsing, I showed a very basic example of developing REST Service with Grails Controller and JAXB. In this blog I am going to cover little more advanced features and will mainly be covering following.
  • Collection mapping in JAXB
  • Exception Handling
  • Returning response in XML
  • URLMappings for Grails Controller

Friday, May 4, 2012

Grails : Rest Service with JAXB parsing - PART 1

In this blog I will show how RESTful Web Service can be developed in Grails without the use of any plugins. I will just make use of Grails Controller and JAXB parser to marshal/unmarshal xml.I have divided this into 2 parts blog series. In this blog I will cover very basic usage. In next blog it will be little more advanced with Exception handling.

So let's develop a REST service to create Employee Details. Suppose we have a xml in following format which represents Employee Details.

<?xml version="1.0" encoding="utf-8"?>
<Employee_Details>
    <employee_name>Gagan</employee_name>
    <employee_age>28</employee_age>
    <employee_department>SOFTWARE</employee_department>
</Employee_Details