TransWikia.com

PHP+SOAP. Is it possible to make multiple tries creating new SoapClient?

Stack Overflow Asked by Alexander Rusanov on December 1, 2021

I am using SOAP-service which sometimes is not available, so I wish to make multiple tries until it succeeds.

I do know about is_soap_fault(), but I get

"Fatal error: SOAP-ERROR: Parsing WSDL: Couldn’t load…"

before I can use the function.

Here is an example:

do
 {
     $client_temp =
     new SoapClient($wsdlurl,
         array(
             'trace'=> 1,
             'exceptions' => 0,
             'encoding' => 'UTF-8',
             'passphrase' => '',
             'stream_context' => stream_context_create
             (
             array(
             'http' => array
                (
             
             'header' => 'Authorization: Bearer '.$token.'
    Client-Login: '.$login
            .nl.'Accept-Language: ru'

                )
             )
             )
         )
     );
 }
 while(is_soap_fault($client_temp));

One Answer

I've found a partial solution. Save $wsdlurl locally (that is where I can do multiple tries) and then put path to the file in SoapClient arguments (instead of $wsdlurl)

Answered by Alexander Rusanov on December 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP