Discussion:
Ignore unexpected element UnmarshalException
Jeremy Robertson
2011-03-28 18:57:46 UTC
Permalink
Is there a way to configure a CXF service to ignore the javax.xml.bind.UnmarshalException "unexpected element"?

The desired functionality is that when the unmarshaller hits an element that it does not understand, it ignores it and moves on, rather than throwing the above exception.

We generate both services and clients, and in previous versions of CXF (I think pre 2.3), elements that were not understood were ignored. This allowed us to extend data objects in the service without having to rebuild clients in legacy systems. Having upgraded a project to 2.3.1, I am now getting the unexpected element error (I'm not entirely sure what other dependencies were also upgraded, so it may be separate from CXF, in which case, sorry to bother).

Is there a property I can set on the JAXBDataBinding class that will affect this? Is there somewhere online I should be looking (I've tried, but haven't found much yet)?

Thanks for your time,
Jeremy


NOTICE: This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
Daniel Kulp
2011-03-28 19:06:51 UTC
Permalink
You can set:

"set-jaxb-validation-event-handler" to "false"

as an endpoint/request property. That should cause it to ignore the
unknown elements again.

Dan
Post by Jeremy Robertson
Is there a way to configure a CXF service to ignore the
javax.xml.bind.UnmarshalException "unexpected element"?
The desired functionality is that when the unmarshaller hits an element
that it does not understand, it ignores it and moves on, rather than
throwing the above exception.
We generate both services and clients, and in previous versions of CXF (I
think pre 2.3), elements that were not understood were ignored. This
allowed us to extend data objects in the service without having to rebuild
clients in legacy systems. Having upgraded a project to 2.3.1, I am now
getting the unexpected element error (I'm not entirely sure what other
dependencies were also upgraded, so it may be separate from CXF, in which
case, sorry to bother).
Is there a property I can set on the JAXBDataBinding class that will affect
this? Is there somewhere online I should be looking (I've tried, but
haven't found much yet)?
Thanks for your time,
Jeremy
NOTICE: This email message is for the sole use of the intended
recipient(s) and may contain confidential and privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited. If you
are not the intended recipient, please contact the sender by reply email
and destroy all copies of the original message.
--
Daniel Kulp
dkulp-1oDqGaOF3Lkdnm+***@public.gmane.org
http://dankulp.com/blog
Talend - http://www.talend.com
Sergey Beryozkin
2011-03-28 20:11:59 UTC
Permalink
Experimenting with the transformation feature [1], 2.4.0-SNAPSHOT only, may
also be of interest. Using this feature may allow for a more selective
configuration, allowing for some elements which do not have to understood,
be ignored, while still having the validation on...

Sergey

[1] http://cxf.apache.org/docs/transformationfeature.html
Post by Daniel Kulp
"set-jaxb-validation-event-handler" to "false"
as an endpoint/request property. That should cause it to ignore the
unknown elements again.
Dan
Post by Jeremy Robertson
Is there a way to configure a CXF service to ignore the
javax.xml.bind.UnmarshalException "unexpected element"?
The desired functionality is that when the unmarshaller hits an element
that it does not understand, it ignores it and moves on, rather than
throwing the above exception.
We generate both services and clients, and in previous versions of CXF (I
think pre 2.3), elements that were not understood were ignored. This
allowed us to extend data objects in the service without having to
rebuild
Post by Jeremy Robertson
clients in legacy systems. Having upgraded a project to 2.3.1, I am now
getting the unexpected element error (I'm not entirely sure what other
dependencies were also upgraded, so it may be separate from CXF, in which
case, sorry to bother).
Is there a property I can set on the JAXBDataBinding class that will
affect
Post by Jeremy Robertson
this? Is there somewhere online I should be looking (I've tried, but
haven't found much yet)?
Thanks for your time,
Jeremy
NOTICE: This email message is for the sole use of the intended
recipient(s) and may contain confidential and privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited. If
you
Post by Jeremy Robertson
are not the intended recipient, please contact the sender by reply email
and destroy all copies of the original message.
--
Daniel Kulp
http://dankulp.com/blog
Talend - http://www.talend.com
Loading...