1. Why CXF 2.6, an ancient version?

2. It's unrealistic to expect that all classes that come from libraries
will be serializable by JAXB. You should probably create your own
JAXB-friendly object to contain what information you want from the
ConstraintViolation; otherwise, you'll need to do all the JAXB
customization needed to deal with the interface. make your own class that
implements ConstraintViolation and can be constructed from a
ConstraintViolation, send those over the service.

On Wed, Jan 6, 2016 at 8:33 PM, badpenny <[email protected]> wrote:

> Greetings from the newest member of the list!
>
> Java 7, Spring 4, CXF 2.6.1
>
> I've split my Java/Spring/CXF/Hibernate/MySQL/Maven monolithic webapp into
> a
> SOAP web service and a corresponding web client. I'm having a terrible time
> handling exceptions/SOAP faults.
>
> Problem 1.
>
> On the client I've created CXF Interceptors that extends
> AbstractSoapInterceptor, and added this snippet to my client_context.xml:
>
>
>   <bean id="myInSoapFaultInterceptor"
> class="gov.zz.dept.forms.web.resolver.MyInSoapFaultInterceptor" />
>   <bean id="myOutSoapFaultInterceptor"
> class="gov.zz.dept.forms.web.resolver.MyOutSoapFaultInterceptor" />
>
>   <cxf:bus>
>     <cxf:inFaultInterceptors>
>       <ref bean="myInSoapFaultInterceptor"/>
>     </cxf:inFaultInterceptors>
>     <cxf:outFaultInterceptors>
>       <ref bean="myOutSoapFaultInterceptor"/>
>     </cxf:outFaultInterceptors>
>   </cxf:bus>
>
> but the client does NOT have a cxf.xml file.
>
> Problem is my interceptors never get triggered.
>
> Problem 2.
>
> On the service I've implemented JSR-303 bean validation, which when
> violations
> occur generates a ConstraintViolationException and throws it up the stack.
> CVE
> consists of a Set<ConstraintViolation> . CVE cannot be converted to XML
> because ConstraintViolation is an interface and the dreaded
> "ConstraintViolation is an interface and JAXB can't handle interfaces"
> errmsg
> pops up. Googling reveals this is not an uncommon problem but all solutions
> assume Foo is an interface under your creation/control. So I need a way to
> get
> ConstraintViolations to XML on the service, throw the SoapFault, have
> client
> catch SoapFault, convert XML back to ConstraintViolation so as to pass CVE
> back to the Spring Form-backing bean so the pretty error messages appear
> correctly on the web form.
>
> I've read the PACKT book about CXF web services but it's pretty thin on
> error-handling with interceptors and has none of the subtlties real-world
> code
> has to contend with. I'd appreciate any suggestions, pointers, constructive
> criticisms or especially examples of how other smarter people handle this
> stuff.
>
> Thank You,
>
> Chris
>
>

Reply via email to