user1648314
user1648314

Reputation: 83

Logging the SOAP message through ValidationEventHandler

Here's the thing: I am trying to set up a schema validation through cxf with a custom validation event handler. My configuration looks something like this:

<cxf:cxfEndpoint id="personEndpoint" address="/person"
    serviceClass="org.apache.servicemix.samples.wsdl_first.Person"
    wsdlURL="wsdl/person.wsdl">
    <cxf:properties>
        <entry key="schema-validation-enabled" value="true" />
        <entry key="jaxb-validation-event-handler">
            <bean class="org.dpytel.servicemix.camel.MyCustomHandler" />
        </entry>
    </cxf:properties>
</cxf:cxfEndpoint>

This is working fine - the schema validation is checked and when errors are encountered, "MyCustomHandler" gets executed. My problem is that I want to save the whole message that caused the validation error to a file, but inside "MyCustomHandler" I don't have this information available (only some error message and the location)

Is there some other way to validate schema with cxf and log the message if something goes wrong?

Upvotes: 1

Views: 638

Answers (1)

Ben Goldin
Ben Goldin

Reputation: 589

You can use CXF Fault Interceptor to access the message content while validation exception will cause a fault:

http://fusesource.com/docs/esb/4.4.1/cxf_interceptors/CXFInterceptorImplMessage.html

Upvotes: 1

Related Questions