The exceptions that CXF generates for WSDL soap faults (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 causing the exception is placed by Cxf in a FaultInfo field not natively reported in the exception CXF generates using wsdl2java. This project contains root exceptions you can use that are much more convenient and provide needed information to support personnel.
- Java JDK 6.0 or above (it was compiled under JDK 7 using 1.6 as the target source).
- Apache Commons Lang version 3.0 or above
CxfExceptionUtils is easy to install whether you use maven or not.
com.postini.pstn.soapapi.v2.automatedbatch.BatchException_Exception: meaningless exception message
Exception Context:
[1:cxfclient.message=meaningful 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)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
com.postini.pstn.soapapi.v2.automatedbatch.BatchException_Exception: meaningles exception message
at org.force66.cxfutils.CxfSoapFaultRuntimeExceptionTest.testBasic(CxfSoapFaultRuntimeExceptionTest.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Maven users can find dependency information here.
Include the following jars in your class path:
- Download the CxfExceptionUtils jar from Github and put it in your class path.
- Insure Apache Commons Lang version 3.0 or above is in your class path.
Specify either CxfSoapFaultException or CxfSoapFaultRuntimeException as the root exception used with Cxf' wsdl2java.
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>
<wsdlRoot>${basedir}/src/main/resources/wsdl</wsdlRoot>
<includes>
<include>*.wsdl</include>
</includes>
<defaultOptions>
<exceptionSuper>org.force66.cxfutils.CxfSoapFaultRuntimeException</exceptionSuper>
</defaultOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>