The code shows that if this property is enabled then JAXB
ValidationEventHandler implementation is set...
Cheers. Sergey
On 11/03/14 16:31, Diana ALLAM wrote:
Thank you for your reply.
I have a last question please.
Could I have more implementation details about
"set-jaxb-validation-event-handler", which is used in the beans.xml file in
jaxws;properties?
I know that JAXB allows adding handlers to marshaller, unmarshaller or
validator.
Does the "set-jaxb-validation-event-handler" correspond to a particular cxf
Handler? If yes, which is exactly please?
I have the cxf source code, and I see that "set-jaxb-validation-event-handler"
is used in DataReaderImpl, but it's difficult to get how it works.
Regards,
Diana
On 11 mars 2014, at 16:45, Sergey Beryozkin wrote:
You can use StaxTransformFeature to drop unexpected elements (such as
Description) or XSLTTransformFeature, follow the links at the end of
http://cxf.apache.org/docs/featureslist.html
Cheers, Sergey
On 11/03/14 13:23, allam-di14 wrote:
I have the following operation op provided by a server:
void op(A a)
Such that A has two attributes "key" and "value".
I would like to invoke this operation using the following payload:
Payload:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns3:op xmlns:ns2="http://test/" xmlns:ns3="http://server/">
<arg0>
<key>1</key>
<value>Diana</value>
<description>PHD</description>
</arg0>
</ns3:op>
</soap:Body>
</soap:Envelope>
This payload has an additional element "description", at unmarshalling, the
following exception is thrown:
org.apache.cxf.interceptor.Fault: Unmarshalling Error: unexpected element
(uri:"", local:"description"). Expected elements are <{}value>,<{}key>
at
org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:881)
at
org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:702)
...
This exception is due to JAXB validation Event Handler.
I can get rid of it with the following spring configuration :
<jaxws:properties>
<entry key="schema-validation-enabled" value="false" />
<entry key="set-jaxb-validation-event-handler" value="false" />
</jaxws:properties>
But disabling the JAXB validator is not a good thing.
I would like to do it better by unmarshalling my payload as JAXBElement,
because it will ignore the additional XML elements.
Regards,
Diana
--
View this message in context:
http://cxf.547215.n5.nabble.com/XmlRootElement-with-jax-rs-jax-ws-tp566400p5741094.html
Sent from the cxf-user mailing list archive at Nabble.com.
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com