Recording errors from Soap-Server

Asked

Viewed 15 times

0

I have a client-Soap in Laravel and I would like to know how to save errors coming back from Soap-server in a file. Below is the code of my client-Soap and where does the request for Soap-server.

        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 take the $fault->faultstring error and record, as I would do it?

1 answer

1

You can do it this way:

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

Reference

This name is just for example, you can either change the name, or add folders before, or change the extension. Follow another example:

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.