This kind of looks like a bug to me.  

Can you log a JIRA?  If you'd like to tackle a fix, you would need to update 
the JAXB DataWriterImpl to add the setProperties method that behaves similar 
to the reader version.    

Thanks!
Dan




On Tuesday, November 15, 2011 11:05:20 AM Vincent Boulaye wrote:
> Hello,
> 
> I have a problem setting a custom validation event handler in cxf for a
> Marshaller.
> I can only setup the custom handler when reading a XML, not writing it.
> (I need to have some logging when the marshalling does not behave as
> expected, for example when marshalling a datetime that has undefined time,
> jaxb output nothing, but I cannot see anything in the logs)
> 
> I tried this with various cxf versions (2.4.4 and 2.5.0).
> 
> I setup the handler in the spring configuration file:
> 
>     <jaxws:endpoint id="myEndpoint"
>         implementor="#beanService" address="/service" >
>         <jaxws:properties>
>             <entry key="jaxb-validation-event-handler"
> value-ref="loggingValidationEventHandler" />
>         </jaxws:properties>
>     </jaxws:endpoint>
> 
>     <bean id="loggingValidationEventHandler"
> class="test.LoggingValidationEventHandler" />
> 
> From what I can see debugging, there is a difference in the way the
> Marshaller is set in DataReaderImpl and DataWriterImpl:
> 
> In the DataReaderImpl, in the setProperty method, I see code that reads the
> properties:
>             veventHandler =
> (ValidationEventHandler)m.getContextualProperty("jaxb-validation-event-handl
> er"); if (veventHandler == null) {
>                 veventHandler = databinding.getValidationEventHandler();
>             }
>             setEventHandler = MessageUtils.getContextualBoolean(m,
> "set-jaxb-validation-event-handler", true);
> 
> and in createUnmarshaller there is something to set the custom handler:
>   if (setEventHandler) {
>      um.setEventHandler(new WSUIDValidationHandler(veventHandler));
>   }
> 
> 
> But in DataWriterImpl the properties are not read, and in createMarshaller
> I only see:
>             if (databinding.getValidationEventHandler() != null) {
> 
> marshaller.setEventHandler(databinding.getValidationEventHandler());
>             }
> 
> I could not find a way to set the validation event handler in databinding.
> 
> How can I set the custom ValidationHandler in the Marshaller ?
> 
> Thanks & Regards,
> Vincent
-- 
Daniel Kulp
[email protected]
http://dankulp.com/blog
Talend - http://www.talend.com

Reply via email to