views:

198

answers:

1

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"&gt;&lt;soap:Body&gt;&lt;soap:Fault&gt;&lt;soap:Code&gt;&lt;soap:Value&gt;soap:Sender&lt;/soap:Value&gt;&lt;/soap:Code&gt;&lt;soap:Reason&gt;&lt;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/"&gt;&lt;Area&gt;Security&lt;/Area&gt;&lt;ErrorCode&gt;1&lt;/ErrorCode&gt;&lt;Message&gt;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.
A: 

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

Tiago
What if I can't control the server?
Andreas Hoffmann