title: Problems importing WSDL using WCF
body: <p>I'm trying with WCF to import WSDL for a web service provided by one of my company's partners. The web service is written in Java. I get this error:</p>
  
  <blockquote>
    <p>Warning: Fault named FooException in operation getUnits cannot be imported. Unsupported WSDL, the fault message part must reference an element. This fault message does not reference an element. If you have edit access to the WSDL document, you can fix the problem by referencing a schema element using the 'element' attribute.</p>
  </blockquote>
  
  <p>Well, not actually an error, but in the generated code FooException is ignored. FooException contains an error code which I really need.</p>
  
  <p>I've shortened the WSDL and only kept one of the methods. I've also renamed some things (like the exception).</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;wsdl:definitions targetNamespace="urn:testws.foo.se"
                    xmlns:apachesoap="http://xml.apache.org/xml-soap"
                    xmlns:impl="urn:testws.foo.se"
                    xmlns:intf="urn:testws.foo.se"
                    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
                    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
                    xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
                    xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
    &lt;!--WSDL created by Apache Axis version: 1.4
  Built on Apr 22, 2006 (06:55:48 PDT)--&gt;
    &lt;wsdl:types&gt;
      &lt;schema targetNamespace="urn:testws.foo.se" xmlns="http://www.w3.org/2001/XMLSchema"&gt;
        &lt;import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/"/&gt;
  
        &lt;complexType name="ArrayOf_soapenc_string"&gt;
          &lt;complexContent&gt;
            &lt;restriction base="soapenc:Array"&gt;
              &lt;attribute ref="soapenc:arrayType" wsdl:arrayType="soapenc:string[]"/&gt;
            &lt;/restriction&gt;
          &lt;/complexContent&gt;
        &lt;/complexType&gt;
  
        &lt;complexType name="FooException"&gt;
          &lt;sequence&gt;
            &lt;element name="errorCode" nillable="true" type="soapenc:string"/&gt;
            &lt;element name="errorDescription" nillable="true" type="soapenc:string"/&gt;
            &lt;element name="variables" nillable="true" type="impl:ArrayOf_soapenc_string"/&gt;
          &lt;/sequence&gt;
        &lt;/complexType&gt;
        &lt;element name="FooException" type="impl:FooException" nillable="true" /&gt;
  
        &lt;complexType name="WsUnit"&gt;
          &lt;sequence&gt;
            &lt;element name="id" nillable="true" type="soapenc:string"/&gt;
            &lt;element name="name" nillable="true" type="soapenc:string"/&gt;
          &lt;/sequence&gt;
        &lt;/complexType&gt;
  
        &lt;complexType name="ArrayOfWsUnit"&gt;
          &lt;complexContent&gt;
            &lt;restriction base="soapenc:Array"&gt;
              &lt;attribute ref="soapenc:arrayType" wsdl:arrayType="impl:WsUnit[]"/&gt;
            &lt;/restriction&gt;
          &lt;/complexContent&gt;
        &lt;/complexType&gt;
      &lt;/schema&gt;
    &lt;/wsdl:types&gt;
  
    &lt;wsdl:message name="getUnitsRequest"&gt;
    &lt;/wsdl:message&gt;
    &lt;wsdl:message name="getUnitsResponse"&gt;
      &lt;wsdl:part name="getUnitsReturn" type="impl:ArrayOfWsUnit"/&gt;
    &lt;/wsdl:message&gt;
    &lt;wsdl:message name="FooException"&gt;
      &lt;wsdl:part name="fault" type="impl:FooException"/&gt;
    &lt;/wsdl:message&gt;
  
    &lt;wsdl:portType name="MyTest"&gt;
      &lt;wsdl:operation name="getUnits"&gt;
        &lt;wsdl:input message="impl:getUnitsRequest" name="getUnitsRequest"/&gt;
        &lt;wsdl:output message="impl:getUnitsResponse" name="getUnitsResponse"/&gt;
        &lt;wsdl:fault message="impl:FooException" name="FooException"/&gt;
      &lt;/wsdl:operation&gt;
    &lt;/wsdl:portType&gt;
  
    &lt;wsdl:binding name="MyTestSoapBinding" type="impl:MyTest"&gt;
      &lt;wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/&gt;
      &lt;wsdl:operation name="getUnits"&gt;
        &lt;wsdlsoap:operation soapAction=""/&gt;
        &lt;wsdl:input name="getUnitsRequest"&gt;
          &lt;wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:testws.foo.se" use="encoded"/&gt;
        &lt;/wsdl:input&gt;
        &lt;wsdl:output name="getUnitsResponse"&gt;
          &lt;wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:testws.foo.se" use="encoded"/&gt;
        &lt;/wsdl:output&gt;
        &lt;wsdl:fault name="FooException"&gt;
          &lt;wsdlsoap:fault encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" name="FooException" namespace="urn:testws.foo.se" use="encoded"/&gt;
        &lt;/wsdl:fault&gt;
      &lt;/wsdl:operation&gt;
    &lt;/wsdl:binding&gt;
    &lt;wsdl:service name="MyTestService"&gt;
      &lt;wsdl:port binding="impl:MyTestSoapBinding" name="MyTest"&gt;
        &lt;wsdlsoap:address location="http://localhost:8080/axis/services/MyTest"/&gt;
      &lt;/wsdl:port&gt;
    &lt;/wsdl:service&gt;
  &lt;/wsdl:definitions&gt;
  </code></pre>
  
  <p>I've tried to just change "type" to "element" in the message part for FooException, but it results in errors. What more do I need to do?</p>