The response of the SOAP request is the following xml output.
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring xml:lang="en">INVALID_REQUEST - Request is not a valid for XSD rules.</faultstring>
<detail>
<ServiceError xmlns="http://test.test.com/xmlschema/common">
<code>INVALID_REQUEST</code>
<description>Request is not a valid for XSD rules.</description>
<details>cvc-datatype-valid.1.2.1: '?' is not a valid value for 'integer'.</details>
<details>cvc-type.3.1.3: The value '?' of element 'pos:userId' is not valid.</details>
</ServiceError>
</detail>
</SOAP-ENV:Fault>
</SOAP-ENV:Body></SOAP-ENV:Envelope>
While trying to catch this error with FaultException, I created the ServiceError class as below and gave it as TDetail to FaultException. However, I could not catch the details of this error.It doesn't come inside the catch block at all. Where am I going wrong or is there a method you recommend?
try{
//here is the code where i got the error
}
catch (FaultException<ServiceError> e)
{
}
[DataContract]
public class ServiceError
{
[DataMember]
public string code { get; set; }
[DataMember]
public string description { get; set; }
[DataMember]
public string[] details { get; set; }
}