Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-7074

wsdl2java generates invalid Java code when fault element is imported



    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.1.7
    • None
    • Soap Binding
    • None
    • Unknown


      CXF wsdl2java tooling generates invalid Java sources when the fault element in the fault message is imported from a copmilation eposide.

      I created a wsdl that defines a xml schema with an include from a already packaged XSD/bindings jar.

        <xsd:schema targetNamespace="urn:io.fares.model.example.utility" xmlns="urn:io.fares.model.example.utility">
          <xsd:include schemaLocation="utility/Fault.xsd"/>

      it then references an element defined in the referenced schema

      <wsdl:message name="GetCustomerException">
        <wsdl:part name="err" element="u:Fault"/>

      but when it generates code it fails to fully qualify the name of the imported and already generated XML Bean / Java class.

      package io.fares.examples.one.services; // <---- generated into the services' package
      import javax.xml.ws.WebFault;
      // <--- I would expect another import of io.fares.model.example.utility.Fault here
      @WebFault(name = "Fault", targetNamespace = "urn:io.fares.model.example.utility")
      public class GetCustomerException extends RuntimeException {
          public static final long serialVersionUID = 1L;
          private Fault fault; // <--- Fault should be fully qualified class name but its not
          // ...
          public Fault getFaultInfo() {
              return this.fault;

      I think the problem is somewhere around org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.ProcessorUtil.getFullClzName but have not been able to figure out exactly why it fails to insert the fully qualified class name into the generated exception.

      An example showing the failed copmilation can be found on GitHub


        Issue Links



              Unassigned Unassigned
              niels.bertram Niels Bertram
              0 Vote for this issue
              1 Start watching this issue