Skip to content
This repository has been archived by the owner on Feb 21, 2019. It is now read-only.

How to validate or skip only when server is busy #5

Open
olekhy opened this issue Oct 21, 2014 · 4 comments
Open

How to validate or skip only when server is busy #5

olekhy opened this issue Oct 21, 2014 · 4 comments

Comments

@olekhy
Copy link

olekhy commented Oct 21, 2014

Hi Author!

How we need to handle until soap server is buzzy?
Hit from traced exception:

SoapFault Object ( 
    [message:protected] => SERVER_BUSY 
    [string:Exception:private] => 
    [code:protected] => 0 
    [file:protected] => /.../vendor/zendframework/zendframework/library/Zend/Soap/Client.php 
    [line:protected] => 1118 
    [trace:Exception:private] => Array ( 
        [0] => Array ( 
            [file] => /.../vendor/zendframework/zendframework/library/Zend/Soap/Client.php 
            [line] => 1118 
            [function] => __soapCall 
            [class] => SoapClient 
            [type] => -> 
            [args] => Array ( 
                    [0] => checkVat 
                    [1] => Array ( 
                        [0] => Array ( 
                            [countryCode] => DE 
                            [vatNumber] => 815246684 
)
@olekhy
Copy link
Author

olekhy commented Oct 26, 2014

may be add more error messages to validator?
I found here: http://forums.oscommerce.de/topic/73224-fehler-abfrage-vat-intracom-number/page-3

try {
    $result = $client->checkVat($params);
} catch (SoapFault $e) { 
    $result = $e->faultstring;
    $regex = '/\{ \'([A-Z_]*)\' \}/';
    $n = preg_match($regex, $result, $matches);
    $result = $matches[1];
    $faults = array(
        'INVALID_INPUT'       => 'The provided CountryCode is invalid or the VAT number is empty',
    'SERVICE_UNAVAILABLE' => 'The SOAP service is unavailable, try again later',
        'MS_UNAVAILABLE'      => 'The Member State service is unavailable, try again later or with another Member State',
        'TIMEOUT'             => 'The Member State service could not be reached in time, try again later or with another Member State',
        'SERVER_BUSY'         => 'The service cannot process your request. Try again later.'
    );        

   $this->error($faults[$result]);
   return false;         
}

@olekhy
Copy link
Author

olekhy commented Oct 31, 2014

hu hu... 👶

@mwillbanks
Copy link
Owner

@olekhy
Sorry my apologies.... For some reason github did not email me the notification. I'll attempt to look at tonight.

@olekhy
Copy link
Author

olekhy commented Nov 5, 2014

thx

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants