cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <>
Subject Re: JAXWS 2.2 : Service.createDispatch with JAXBContext
Date Wed, 01 Sep 2010 11:00:52 GMT
This good tutorial [1] explains (see the section about Dispacth<Object> ) :

" In JAXB 2, instances of generated classes like Hello_Type stand for
instantiations of a schema complex type (which is somehow the *value* of an
element), *not* instances of elements themselves. These objects have to be
wrapped in JAXBElement instances to represent XML elements"

So in such cases it is obvious why JAXBElement has to be used.

Thus, is it the case that a cast to a direct class only works when  a user
has an @XmlRootElement annotated class representing the actual response and
an appropriate ObjectFactory ?

If so then it is unclear to me how a framework can decide whether to unwrap
JAXBElement or not, given that it is the client code which knows about the
actual cast.

So I guess if the client wants a cast to a concrete class then it has to
configure a binding to unwrap ?

cheers, Sergey


On Tue, Aug 31, 2010 at 6:41 PM, Sergey Beryozkin <>wrote:

> Hi
> JAXWS Service class has few methods to do with with creating
> Dispatch<Object>, accepting JAXBContexts.
> I've seen the examples on the web showing the results of the invocations
> being cast to JAXBElement (which is what CXF does too
> due to JAXBDataBinding defaulting to it in such cases).
> I've just checked the JAXWS 2.2 spec and I can see an example showing the
> cast to a concrete class.
> In both cases I've seen the service mode being set to PAYLOAD.
> Can someone please clarify when exactly should the cast be done to
> JAXBElement as opposed to a concrete class ?
> thanks, Sergey

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message