cxf-codegen-plugin, wsdl2java, Can web faults implements generic interface ?

Solution Verified - Updated -

Issue

  • We have a wsdl file, in which operation includes several faults. Each fault has the same structure.
  • For example, below.
<wsdl:portType name="SomePort">
    <wsdl:operation name="SomeOperation">
      <wsdl:input message="tns:input1">
    </wsdl:input>
      <wsdl:output message="tns:inputResponse1">
    </wsdl:output>
      <wsdl:fault message="tns:exception1" name="exception1">
    </wsdl:fault>
      <wsdl:fault message="tns:exception2" name="exception2">
    </wsdl:fault>
      <wsdl:fault message="tns:exception3" name="exception3">
    </wsdl:fault>
      <wsdl:fault message="tns:exception4" name="exception4">
    </wsdl:fault>
      <wsdl:fault message="tns:exception5" name="exception5">
    </wsdl:fault>
    </wsdl:operation>
  </wsdl:portType>
  • cxf-codegen-plugin creates Java classes that are inherited from Exception.
public class Exception1 extends Exception
public class Exception2 extends Exception
public class Exception3 extends Exception
public class Exception4 extends Exception
public class Exception5 extends Exception
  • Each class has a method getFaultInfo(), that returns the "details" of soap fault.
  • Any of mentioned exceptional situations can occur while calling the web service using jaxws. Exceptions should be treated in the same way.
    It is uncomfortable to handle these situtation because it is impossible to cast this exception to general type with method getFaultInfo().
  • Is it possible to make the classes Exception1, Exception2 etc. implement a generic interface ?

Environment

  • Red Hat JBoss Fuse
    • 6.x
  • Apache CXF

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content