mirror of
https://github.com/ToxicCrack/PrintABrick.git
synced 2025-05-20 06:00:08 -07:00
Use local wsdl file to avoid SOAP uncatchable FatalErrorException
This commit is contained in:
parent
7a2afca00a
commit
5b6bc7b6c8
2564
app/config/brickset.xml
Normal file
2564
app/config/brickset.xml
Normal file
File diff suppressed because it is too large
Load Diff
@ -9,8 +9,6 @@ parameters:
|
||||
locale: en
|
||||
# rebrickable csv files root URL
|
||||
rebrickable_url: 'http://rebrickable.com/media/downloads/'
|
||||
# LDraw library zip file URL
|
||||
ldraw_url: 'http://www.ldraw.org/library/updates/complete.zip'
|
||||
|
||||
framework:
|
||||
#esi: ~
|
||||
|
@ -1,7 +1,7 @@
|
||||
services:
|
||||
api.client.brickset:
|
||||
class: AppBundle\Api\Client\Brickset\Brickset
|
||||
arguments: ['%brickset_apikey%']
|
||||
arguments: ['%brickset_apikey%', '%kernel.root_dir%/config/brickset.xml']
|
||||
api.client.rebrickable:
|
||||
class: AppBundle\Api\Client\Rebrickable\Rebrickable_v3
|
||||
arguments: ['%rebrickable_apikey%']
|
||||
|
@ -47,6 +47,7 @@ class Brickset extends \SoapClient
|
||||
$this->apiKey = $apikey;
|
||||
|
||||
$options['cache_wsdl'] = WSDL_CACHE_NONE;
|
||||
$options['exceptions'] = true;
|
||||
|
||||
foreach (self::$classmap as $key => $value) {
|
||||
if (!isset($options['classmap'][$key])) {
|
||||
@ -56,7 +57,12 @@ class Brickset extends \SoapClient
|
||||
if (!$wsdl) {
|
||||
$wsdl = self::WSDL;
|
||||
}
|
||||
parent::__construct($wsdl, $options);
|
||||
|
||||
try {
|
||||
parent::__construct($wsdl, $options);
|
||||
} catch (\Exception $exception) {
|
||||
throw new ApiException(ApiException::BRICKSET);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -78,6 +84,8 @@ class Brickset extends \SoapClient
|
||||
throw new CallFailedException(ApiException::BRICKSET);
|
||||
} catch (ContextErrorException $e) {
|
||||
throw new EmptyResponseException(ApiException::BRICKSET);
|
||||
} catch (\Exception $e) {
|
||||
throw new ApiException(ApiException::BRICKSET);
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,7 +113,7 @@ class Brickset extends \SoapClient
|
||||
|
||||
$response = $this->call('getSets', $parameters)->sets;
|
||||
|
||||
return is_array($response) ? $response : [$response];
|
||||
return is_array($response) ? $response : [$this->getSet($response->getSetID())];
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user