简体   繁体   中英

CXF annotation: how to be fault-tolerant?

Is there an annotation to tell JAXB (or a configuration with CXF 3.1?) to be more fault tolerant?

DTO class attribute:

private List<Address> address;

Part of XML SOAP response parsed:

<address xsi:type="axis2ns185:anyType">
  <empty>true</empty>
</address>

Exception thrown:

Caused by: com.sun.istack.SAXParseException2; ...; 
unexpected element (uri:"", local:"empty"). Expected elements are ...

I would like this scenario result in an empty list of Address...

To remove validation (and exceptions from validation) during parsing:

JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
Map<String, Object> propertiesMap = new HashMap<String, Object>();
propertiesMap.put("set-jaxb-validation-event-handler", "false");
factory.setProperties(propertiesMap);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM