title: Axis2 Web Services and Eclipse WSDL authoring: Adding an axis fault to wsdl causes exception when running wsdl2java
body: <p>I am trying to create a contract-first Web Service using Apache Axis2 1.4.1. Since Eclipse has what seems like a pretty complete wsdl editor I started autoring my wsdls using Eclipse´s editor. Everything works great, I can generate Java classes using wsdl2java and the Web Services work when deployed. However, adding an exception or fault to a Web Service results in an exception saying that Element QName is null for the Fault. Does anyone know what may cause this? Inspecting the wsdl doesn´t give me any direct answers either. It seems the Fault/exception is defined just like other elements.</p>
  
  <p>Here´s the command and stack trace: </p>
  
  <pre><code>&gt;d:\axis2-1.4.1\bin\wsdl2java.bat -o src-test -ss -uri JavaIntegrationModule.wsdl
  Using AXIS2_HOME:   D:\axis2-1.4.1
  Using JAVA_HOME:    D:\Java\jdk1.5.0_14
  Retrieving document at 'JavaIntegrationModule.wsdl'.
  [INFO] The src-test\src\org\example\www\javaintegrationmodule\JavaIntegrationModuleSkeleton.java file cannot be overwritten.
  [INFO] The src-test\src\org\example\www\javaintegrationmodule\JavaIntegrationModuleMessageReceiverInOut.java file cannot be overwritten.
  D:\&gt;d:\axis2-1.4.1\bin\wsdl2java.bat -o src-test -ss -uri JavaIntegrationModule.wsdl
  Using AXIS2_HOME:   D:\axis2-1.4.1
  Using JAVA_HOME:    D:\Java\jdk1.5.0_14
  Retrieving document at 'JavaIntegrationModule.wsdl'.
  D:\&gt;d:\axis2-1.4.1\bin\wsdl2java.bat -o src-test -ss -uri JavaIntegrationModule.wsdl
  Using AXIS2_HOME:   D:\axis2-1.4.1
  Using JAVA_HOME:    D:\Java\jdk1.5.0_14
  Retrieving document at 'JavaIntegrationModule.wsdl'.
  Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: org.apache.axis2.wsdl.codegen.CodeGenerationException: jav
  a.lang.RuntimeException: Element QName is null for getSolutionByIdFault!
          at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:271)
          at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
          at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
  Caused by: org.apache.axis2.wsdl.codegen.CodeGenerationException: java.lang.RuntimeException: Element QName is null for getSolutionByIdFault
  !
          at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.emitSkeleton(AxisServiceBasedMultiLanguageEmitter.java
  :1370)
          at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:253)
          ... 2 more
  Caused by: java.lang.RuntimeException: Element QName is null for getSolutionByIdFault!
          at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.getFaultParamElements(AxisServiceBasedMultiLanguageEmi
  tter.java:2829)
          at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.getFaultElement(AxisServiceBasedMultiLanguageEmitter.j
  ava:2748)
          at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.generateMethodElement(AxisServiceBasedMultiLanguageEmi
  tter.java:2269)
          at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.loadOperations(AxisServiceBasedMultiLanguageEmitter.ja
  va:2151)
          at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.createDOMDocumentForSkeleton(AxisServiceBasedMultiLang
  uageEmitter.java:2065)
          at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.writeSkeleton(AxisServiceBasedMultiLanguageEmitter.jav
  a:1991)
          at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.emitSkeleton(AxisServiceBasedMultiLanguageEmitter.java
  :1327)
          ... 3 more
  </code></pre>
  
  <p>and the WSDL file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.example.org/JavaIntegrationModule/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="JavaIntegrationModule" targetNamespace="http://www.example.org/JavaIntegrationModule/"&gt;
    &lt;wsdl:types&gt;
      &lt;xsd:schema targetNamespace="http://www.example.org/JavaIntegrationModule/"&gt;
        &lt;xsd:element name="getSolutionById"&gt;
          &lt;xsd:complexType&gt;
            &lt;xsd:sequence&gt;
              &lt;xsd:element name="in" type="xsd:string"/&gt;
            &lt;/xsd:sequence&gt;
          &lt;/xsd:complexType&gt;
        &lt;/xsd:element&gt;
        &lt;xsd:element name="getSolutionByIdResponse"&gt;
          &lt;xsd:complexType&gt;
            &lt;xsd:sequence&gt;
              &lt;xsd:element name="out" type="xsd:string"/&gt;
            &lt;/xsd:sequence&gt;
          &lt;/xsd:complexType&gt;
        &lt;/xsd:element&gt;
        &lt;xsd:element name="getSolutionByIdFault"&gt;
         &lt;xsd:complexType&gt;
          &lt;xsd:sequence&gt;
  
           &lt;xsd:element name="getSolutionByIdFault"
            type="xsd:string"&gt;
           &lt;/xsd:element&gt;
          &lt;/xsd:sequence&gt;
         &lt;/xsd:complexType&gt;
        &lt;/xsd:element&gt;
      &lt;/xsd:schema&gt;
    &lt;/wsdl:types&gt;
    &lt;wsdl:message name="getSolutionByIdRequest"&gt;
      &lt;wsdl:part element="tns:getSolutionById" name="parameters"/&gt;
    &lt;/wsdl:message&gt;
    &lt;wsdl:message name="getSolutionByIdResponse"&gt;
      &lt;wsdl:part element="tns:getSolutionByIdResponse" name="parameters"/&gt;
    &lt;/wsdl:message&gt;
    &lt;wsdl:message name="getSolutionByIdFault"&gt;
     &lt;wsdl:part name="parameters" element="tns:getSolutionByIdFault"&gt;&lt;/wsdl:part&gt;
    &lt;/wsdl:message&gt;
    &lt;wsdl:portType name="JavaIntegrationModule"&gt;
      &lt;wsdl:operation name="getSolutionById"&gt;
        &lt;wsdl:input message="tns:getSolutionByIdRequest"/&gt;
        &lt;wsdl:output message="tns:getSolutionByIdResponse"/&gt;
              &lt;wsdl:fault name="fault" message="tns:getSolutionByIdFault"&gt;&lt;/wsdl:fault&gt;
          &lt;/wsdl:operation&gt;
    &lt;/wsdl:portType&gt;
    &lt;wsdl:binding name="JavaIntegrationModuleSOAP" type="tns:JavaIntegrationModule"&gt;
      &lt;soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/&gt;
      &lt;wsdl:operation name="getSolutionById"&gt;
        &lt;soap:operation soapAction="http://www.example.org/JavaIntegrationModule/getSolutionById"/&gt;
        &lt;wsdl:input&gt;
          &lt;soap:body use="literal"/&gt;
        &lt;/wsdl:input&gt;
        &lt;wsdl:output&gt;
          &lt;soap:body use="literal"/&gt;
        &lt;/wsdl:output&gt;
      &lt;/wsdl:operation&gt;
    &lt;/wsdl:binding&gt;
    &lt;wsdl:service name="JavaIntegrationModule"&gt;
      &lt;wsdl:port binding="tns:JavaIntegrationModuleSOAP" name="JavaIntegrationModuleSOAP"&gt;
        &lt;soap:address location="http://www.example.org/"/&gt;
      &lt;/wsdl:port&gt;
    &lt;/wsdl:service&gt;
  &lt;/wsdl:definitions&gt;
  </code></pre>