I have a WebService that returns as the result of the Invokation of the Web-Service a ResponseObject called "CustomerResponse
". When I implement this object "from scratch" everything works fine: My implementation in this case only contains all the needed "Simple Types" like Strings, Integers but NO Object references/associations.
However what I wanted to do is, "reuse" existing Objects. I have in my domain-model a "Customer
" Object that is used in the Application itself. Instead of stupidly more or less cloning the Customer
into the "CustomerReponse" object (by manually typing again all the members/fields), I wanted to base the CutomerResponse
object on the Customer
Object by extension:
class CustomerResponse extends Customer
==> The Problem is that now CustomerResponse
contains some "internal" fields that were inherited from the Customer
Object (like DatabaseID, Security-Stuff) that I do not want to expose via the Web-Service. Furthermore (and thats currently the main problem") Customer
also contains a lot of "object references/associations" to other objects like Address
, Orders
, History
that I do not want to expose via the Webservice either. (It seems that Apache CXF "evaluates" the whole Objectgraph and tries to include them in the ResponseObject...)
==> Is it possible to "Extend" WebService Response Objects based on existing Objects and somehow exclude some "members/fields" of the extended supertyp? (So I want to exclude some members (like the DatabseID) and all of the "object associations" like (Address/Orders/Histroy).. How can I acomplish this, with what annotations and procedures?
Thank you very much!! Jan