You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Gary Weaver <ga...@duke.edu> on 2008/06/30 22:57:59 UTC
mapping from complex response objects to custom value objects - is
it worth it? what is the clearest/easiest/most maintainable way to do it?
Hello,
Though this isn't really a CXF question, I thought it might be good to
ask here to see people's thoughts...
In short, my question is "What is the easiest and most maintainable way
(and able to handle a small but not unsignificant load) of mapping
cxf-codegen-plugin v2.1 + JAXB generated client request and response
value objects (or even the SOAP response itself) to custom-written value
objects? (or is it even worth it?)"
Background:
Have been using Apache CXF cxf-codegen-plugin v2.1 in a project to
generate client code (using the default JAXB data binding) and currently
I have an overly complex and ugly response coming back from one service
that I've integrated with.
Several years ago, I had thought to myself that I would never write
another unnecessary layer of value objects on top of client value
objects autogenerated by a tool like wsdl2java. The reason being that
you have to typically would have to change things in more places when
the service interface changed, despite initial efforts to the contrary
to "buffer" from service interface changes.
However, I'm currently integrating with a few services that
nasty-enough-looking and overly-complicated-enough that I really
couldn't help but to write my own value objects to map to the
cxf-codegen-plugin v2.1 + JAXB generated value objects.
For the first few services, they were fairly simple (comparatively) so I
just mapped these manually in the code (several gets here, several sets
there, and presto). However, the current service I'm working on has a
real bear of a response. If the service interface changes, it is going
to be a good deal of work to redo the additional layer of value objects
in addition to the autogenerated ones.
I looked briefly into using Dozer, but the response classes (because of
the way the service is defined) are so ugly and hard to read that unless
IDea supports auto-completion in the dozer mapping file (like it does
for Spring configs), I don't think I want to go there.
I've also thought about spending more time looking into how I could
configure CXF (or whichever data binding- JAXB, Aegis, MTOM, even though
I'm using JAXB at the moment) to possibly unmarshal the response to my
custom classes, in an attempt to clarify the request/response value
objects by ignoring the fluff and simplifying structure. However, I
don't know if this is the best use of time, and the resulting code would
likely be even less clear, would it not?
Thanks in advance for any advice you can provide,
Gary