aspose file tools*
The moose likes Web Services and the fly likes Returning empty tag in the response xml for an attribute which doesnt exist in the db-REST JAXB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Returning empty tag in the response xml for an attribute which doesnt exist in the db-REST JAXB" Watch "Returning empty tag in the response xml for an attribute which doesnt exist in the db-REST JAXB" New topic
Author

Returning empty tag in the response xml for an attribute which doesnt exist in the db-REST JAXB

Srinivas Yell
Greenhorn

Joined: Apr 02, 2012
Posts: 2
Hi All,

I'm a newbie. I have written a restful webservice using JAXB. My application is written using spring mvc.
So when a web service request for a particular resource comes, it first hits the controller which calls a facade class method. Most of the business logic is written in the facade class using service method calls.
In facade, DTOs (generated as per the response XSD) are populated with the required attribute values. And the controller returns the response which is converted to XML.

Now, the problem which i'm facing is -
1) There are some attributes in the XSD which are not present in the DB.
2) If the attributes are set to null, the tag is getting disappeared from the response xml.

I need to display these attributes as empty tags in the response and i cannot change the XSD. I have searched for the same in google but didn't find any solution.

Controller:
------------


Facade:
---------


Note that XSD cannot be changed and the DTOs i use are automatically generated from XSD during application build. The response xml should have empty tags (no schema entries please) for RscDate and RscNum-
<RscDate />
<RscNum />

Could you please let me know how this can be achieved ?

Thanks
Srinivas
 
 
subject: Returning empty tag in the response xml for an attribute which doesnt exist in the db-REST JAXB