Returning empty tag in the response xml for an attribute which doesnt exist in the db-REST JAXB
posted 3 years ago
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.
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-
Could you please let me know how this can be achieved ?