views:

265

answers:

1

Hello. I have problem with checking SoapFault response from writen in PHP Soap webservice. Responce looks like this (default "throw new SoapFault("SOAP:CLIENT", "Bad login");"

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt;
<SOAP-ENV:Body>
    <SOAP-ENV:Fault>
        <faultcode>SOAP:CLIENT</faultcode>
        <faultstring>Bad login</faultstring>
    </SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

And C# code looks like this:

try
{
   //creating new webservice, filling headers and alling something
   webservice = new...
   items = webservice.getSth();
}
catch ( Exception ex )
{
   MessageBox.Show(ex.Message); -> "Namespace prefix 'SOAP' not defined"
}

When login/pass/apikey etc is OK than i get what i need, but when sth is wrong than i cant display proper information.

How to check if SOAP returned fault? I googled for the problem, but couldnt find valuable information.

Unfortunetly i cant change webservice.

Thanks for any help.

A: 
catch (SoapException ex)
{
    Console.WriteLine(ex.Detail.OuterXml);
}
Darin Dimitrov
Unfortunetly SoapException is empty, when i usetry { .. } catch(SoapException ex ) { .. } catch(Exception ex) { .. } it goes straight to ExceptionTried even with XmlExceptions but they also were "empty"
cichy
Edit: dont know why, but after hundreds of compilations it started to work :/Thx anyway :)
cichy