Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

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

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Men call me Jim. Women look past me to this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic