Question

So I've got a WCF client consuming an ASMX web-service. Everything works fine, except exception handling.

Where I should get a (non-contractual) FaultException, i get the CommunicationException.

What may be wrong?


Here goes the relevant data:

SOAP response (seems to be according to specification):

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><soap:Code><soap:Value>soap:Sender</soap:Value></soap:Code><soap:Reason><soap:Text xml:lang="en">User not found or password is incorrect (User not found)</soap:Text></soap:Reason><soap:Node>Login</soap:Node><detail><ErrorInfo xmlns="http://tempuri.org/"><Area>Security</Area><ErrorCode>1</ErrorCode><Message>User not found or password is incorrect (User not found)</Message></ErrorInfo></detail></soap:Fault></soap:Body></soap:Envelope>

ex.Message (CommunicationException) :

Server returned an invalid SOAP Fault.  Please see InnerException for more details.

ex.InnerException.Message (XmlException) :

End element 'Fault' from namespace 'http://www.w3.org/2003/05/soap-envelope' expected. Found element 'detail' from namespace ''. Line 1, position 444.
Was it helpful?

Solution

The < detail > was not according to the SOAP12 standard (it had no namespace), the service had to be consumed through the SOAP11 endpoint.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top