Handling SOAP Fault - Recovering fault string

  • Vikas Roonwal
    Vikas Roonwal


    I started using NuSOAP and PHP quite recently

    It works great when parsing both rpc/encoded and doc/lit service WSDLs and the clients are easy to use too.
    What I have not been able to do is to extract the Fault String from a SOAP Fault.

    The error message extracted from $client->getError() is

    "XML error parsing SOAP payload on line 1: Attribute redefined"

    This is the SOAP Response

    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
       <faultstring>There is a fault string</faultstring>
        <FaultDetail xmlns="http://mynamespace.com">
         <Message xmlns="http://mynamespace.com">There is a permission issues</Message>
         <Cause xmlns="http://mynamespace.com">The root cause is here</Cause>

    How can I extract the faultstring that is present in the <soap:Fault> ??

    Thanks for any help and response,
    ~ Vikas