You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by "Derek C. Ashmore" <de...@dvtconsulting.com> on 2016/01/02 15:39:38 UTC

CXF: Proposal to make generated exceptions for Faults more useful

Hi -- I tried to create an improvement JIRA for this, but I don't seem 
to have access.  Sorry for the way the proposal is arriving. Thanks for 
looking at this.

This is a proposal for an enhancement to make exceptions generated by 
CXF wsdl2java easier to use. The exceptions that CXF generates for WSDL 
soap faults with web service clients (e.g. input validations, etc) are 
less than helpful. The main reason I say that is that all meaningful 
information somebody would need to solve the issue/ wsdl soap fault 
causing the exception is placed by Cxf in a FaultInfo field not natively 
reported in the exception CXF generates using wsdl2java. To get useful 
information out of a Cxf-generated exception takes custom code. This can 
become a lot of custom code if the service you are consuming defines a 
large number of fault types.

If you like the idea, I'll be happy to migrate it into your code base 
and attach a formal patch. I would need some guidance on which maven 
project this should be included with. I did review proposed enhancements 
and didn't see this.

The proposal is that you provide exceptions for soap faults that include 
this useful field information in the message by default. A sample 
exception log entry for this improved exception contains the useful 
information people need. An example follows:
com.postini.pstn.soapapi.v2.automatedbatch.BatchException_Exception: 
exception message
Exception Context:
[1:cxfclient.message=embedded cxf info]
---------------------------------
at 
org.force66.cxfutils.CxfSoapFaultRuntimeExceptionTest.testBasic(CxfSoapFaultRuntimeExceptionTest.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

I've open-sourced this project and associated code here, but it really 
belongs as a part of the CXF project somewhere: 
https://github.com/Force66/CxfExceptionUtils. Note that this solution 
does utilize the Apache Commons Lang library.

More details around the concept used can be found on my blog here: 
http://www.derekashmore.com/2015/08/exception-handling-issues-for-soap.html
I'll reiterate that ff you like the idea, I'll be happy to migrate it 
into your code base and attach a formal patch. I'm willing to do the work.
-- 
Thanks,
Derek <https://www.linkedin.com/in/derekashmore> 
<https://twitter.com/Derek_Ashmore> <http://www.derekashmore.com/>
Please note that my email address has changed to 
derek.ashmore@dvtconsulting.com