This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Returning empty tag in the response xml for an attribute which doesnt exist in the db-REST JAXB
 
Similar Threads
Loading XML Files into Android App
Integration testing of Spring 2.5 Annotation based controller using web context
No error/exception in log on insert yet no row inserted to db
New to JForum
Doubt in JSP Custom tags (Simple Tag) in Dynamic Drop Down