Niels Bertram created CXF-7074:
----------------------------------

             Summary: wsdl2java generates invalid Java code when fault element 
is imported
                 Key: CXF-7074
                 URL: https://issues.apache.org/jira/browse/CXF-7074
             Project: CXF
          Issue Type: Bug
          Components: Soap Binding
    Affects Versions: 3.1.7
            Reporter: Niels Bertram


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.

{code:xml}
<wsdl:types>
  <xsd:schema targetNamespace="urn:io.fares.model.example.utility" 
xmlns="urn:io.fares.model.example.utility">
    <xsd:include schemaLocation="utility/Fault.xsd"/>
  </xsd:schema>
</wsdl:types>
{code}

it then references an element defined in the referenced schema

{code:xml}
<wsdl:message name="GetCustomerException">
  <wsdl:part name="err" element="u:Fault"/>
</wsdl:message>
{code}

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

{code:java}
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;
    }
}
{code}

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|https://github.com/fareliner/design-builder-examples/tree/master/multi-dependency/service-a]



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to