On Sep 19, 2012, at 3:13 PM, Christian Gräfe <[email protected]> wrote:

> Hello,
> 
> I'm using the CXF version 2.6.2 on the server side with enabled schema
> validation.
> Due to special requirements I need to catch the soap faults, which happens
> after a validation error, and wrap the message into a defined structure.
> Curently I'm using a SOAPMessageHandler to filter he soap fault message.
> 
> I get a fault message like this:
> cvc-enumeration-valid: Value 'Y' is not facet-valid with respect to
> enumeration '[J, N]'. It must be a value from the enumeration.
> 
> It is possible to get the xml element which is causing the problem?

You can register your own javax.xml.bind.ValidationEventHandler with the 
JAXBDataBinding.   The validation events would be passed into there and you can 
pretty much decide to do whatever you want to do with it.  Throw different 
text, etc...

I'm not sure you can get the name of the element easily.   The 
ValidationEventLocator that is passed in with the even has row/col numbers, but 
that's only useful if you buffer then entire soap message.    It also has a 
getNode(), but again, only useful if the message is parsed to DOM first.   
THere is a getObject thing there, but I have NO idea what that returns.  You 
would need to experiment a bit.

Dan



> 
> 
> best regards
> Christian G.

-- 
Daniel Kulp
[email protected] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Reply via email to