title: Web service client receiving generic FaultException rather than FaultException<T>
body: <p>I am connecting to a Java Axis2 web service using a .NET web service client. The client itself targets the .NET 3.5 framework. The application that wraps the client DLL is 2.0. I'm not sure if that has any bearing.</p>
  
  <p>I have been given the WSDL and XSDs by email. From those I have built my proxy class using svcutil. Although I am able to successfully send messages, I am unable to pick up the correct faults when something goes wrong. In the example below, errors are always being picked up by the generic FaultException. </p>
  
  <pre><code>catch (FaultException&lt;InvoiceErrorType&gt; fex)
  {
      OnLog(enLogLevel.ERROR, fex.Detail.ErrorDescription);
  }
  catch (FaultException gfex)
  {
      OnLog(enLogLevel.ERROR, gfex.Message);
  }
  </code></pre>
  
  <p>The proxy client appears to have the appropriate attributes for the FaultContract:</p>
  
  <pre><code>// CODEGEN: Generating message contract since the operation SendInvoiceProvider_Prod is neither RPC nor document wrapped.
  [OperationContractAttribute(Action = "https://private/SendInvoiceProvider", ReplyAction = "*")]
  [FaultContractAttribute(typeof(InvoiceErrorType), Action = "https://private/SendInvoiceProvider", Name = "InvoiceError", Namespace = "urn:company:schema:entities:base")]
  [XmlSerializerFormatAttribute(SupportFaults = true)]
  [ServiceKnownTypeAttribute(typeof(ItemDetail))]
  [ServiceKnownTypeAttribute(typeof(Supplier))]
  OutboundComponent.SendInvoiceProviderResponse SendInvoiceProvider_Prod(OutboundComponent.SendInvoiceProvider_Request request);
  </code></pre>
  
  <p>I have enabled tracing and I can see the content of the fault coming back, but .NET is not recognizing it as an InvoiceError. The SOAP fault in full is:</p>
  
  <pre><code>&lt;soapenv:Fault&gt;
      &lt;faultcode xmlns=""&gt;soapenv:Client&lt;/faultcode&gt;
      &lt;faultstring xmlns=""&gt;Message found to be invalid&lt;/faultstring&gt;
      &lt;faultactor xmlns=""&gt;urn:SendInvoiceProvider&lt;/faultactor&gt;
      &lt;detail xmlns=""&gt;
          &lt;InvoiceError xmlns="urn:company:schema:entities:common:invoiceerror:v01"&gt;
                  &lt;ErrorID&gt;100040&lt;/ErrorID&gt;
                  &lt;ErrorType&gt;UNEXPECTED&lt;/ErrorType&gt;
                  &lt;ErrorDescription&gt;&amp;lt;![CDATA[&amp;lt;error xmlns="urn:company:schema:errordetail:v01"&amp;gt;&amp;lt;errorCode&amp;gt;1000&amp;lt;/errorCode&amp;gt;&amp;lt;highestSeverity&amp;gt;8&amp;lt;/highestSeverity&amp;gt;&amp;lt;errorDetails count="1"&amp;gt;&amp;lt;errorDetail&amp;gt;&amp;lt;errorType&amp;gt;1&amp;lt;/errorType&amp;gt;&amp;lt;errorSeverity&amp;gt;8&amp;lt;/errorSeverity&amp;gt;&amp;lt;errorDescription&amp;gt;cvc-complex-type.2.4.a: Invalid content was found starting with element 'CompanyName'. One of '{"urn:company:schema:sendinvoice:rq:v01":RoleType}' is expected.&amp;lt;/errorDescription&amp;gt;&amp;lt;errorNamespace&amp;gt;urn:company:schema:sendinvoice:rq:v01&amp;lt;/errorNamespace&amp;gt;&amp;lt;errorNode&amp;gt;CompanyName&amp;lt;/errorNode&amp;gt;&amp;lt;errorLine&amp;gt;1&amp;lt;/errorLine&amp;gt;&amp;lt;errorColumn&amp;gt;2556&amp;lt;/errorColumn&amp;gt;&amp;lt;errorXPath/&amp;gt;&amp;lt;errorSource/&amp;gt;&amp;lt;/errorDetail&amp;gt;&amp;lt;/errorDetails&amp;gt;&amp;lt;/error&amp;gt;]]&amp;gt;&lt;/ErrorDescription&gt;
                  &lt;TimeStamp&gt;2010-05-04T21:12:10Z&lt;/TimeStamp&gt;
          &lt;/InvoiceError&gt;
      &lt;/detail&gt;
  &lt;/soapenv:Fault&gt;
  </code></pre>
  
  <p>I have noticed the namespace defined on the error:</p>
  
  <pre><code>&lt;InvoiceError xmlns="urn:company:schema:entities:common:invoiceerror:v01"&gt;
  </code></pre>
  
  <p>This is nowhere to be seen in the generated proxy class, nor in the WSDLs. The interface WSDL defines the error schema namespace as such:</p>
  
  <pre><code>&lt;xs:import namespace="urn:company:schema:entities:base" schemaLocation="InvoiceError.xsd"/&gt;
  </code></pre>
  
  <p>Could this be the reason why the .NET client is not able to parse the typed Fault Exception correctly?</p>
  
  <p>I have no control over the web service itself. I see no reason why .NET can't talk to a Java Axis2 web service. This user had a similar issue, but the reason for his problem cannot be the same as mine, since I can see the fault detail in the trace: <a href="https://stackoverflow.com/questions/864800/does-wcf-faultexceptiont-support-interop-with-a-java-web-service-fault">Does WCF FaultException&lt;T&gt; support interop with a Java web service Fault</a></p>
  
  <p>Any help would be gratefully received.</p>