Write errors from Soap-Server

0

I have a client-soap in laravel and I would like to know how to store in a file the errors that come back from the soap-server. Below is the code for my client-soap and where it does the soap-server pro request.

        try {
        print("<pre>".print_r($client->INC($array),true)."</pre>");

        }
        catch (SoapFault $fault){
        echo 'Requesição : <br/><xmp>',
        print_r($client->getLastRequest()),
        '</xmp><br/>';
        echo "</br>";
        echo 'Resposta da ACM : <br/> <br/><xmp>',
        print_r($client->getLastResponse()),
        $fault->faultstring,
        '</xmp>';
    }

I would like to get the $ fault-> faultstring error and save, how would I do that?

    
asked by anonymous 11.07.2018 / 16:05

1 answer

1

You can do it this way:

$conteudo = $fault->faultstring;
Storage::put('logxml.txt', $conteudo);

Reference

This name is for example only, you can either change the name, add folders before, or change the extension. Here's another example:

$conteudo = $fault->faultstring;
Storage::put('logs-meus/meu-log-xml.xml', $conteudo);
    
13.07.2018 / 21:51