parent
64e1759f45
commit
b1b0fb87f1
|
@ -29,6 +29,8 @@ use Symfony\Component\Config\Loader\LoaderInterface;
|
||||||
*/
|
*/
|
||||||
class WebServiceContext
|
class WebServiceContext
|
||||||
{
|
{
|
||||||
|
private $classmap;
|
||||||
|
|
||||||
private $typeRepository;
|
private $typeRepository;
|
||||||
private $converterRepository;
|
private $converterRepository;
|
||||||
|
|
||||||
|
@ -55,15 +57,20 @@ class WebServiceContext
|
||||||
public function getServiceDefinition()
|
public function getServiceDefinition()
|
||||||
{
|
{
|
||||||
if (null === $this->serviceDefinition) {
|
if (null === $this->serviceDefinition) {
|
||||||
if (!$this->loader->supports($this->options['resource'], $this->options['resource_type'])) {
|
$cacheDefinition = new ConfigCache(sprintf('%s/%s.definition.php', $this->options['cache_dir'], $this->options['name']), $this->options['debug']);
|
||||||
throw new \LogicException(sprintf('Cannot load "%s" (%s)', $this->options['resource'], $this->options['resource_type']));
|
if ($cacheDefinition->isFresh()) {
|
||||||
|
$this->serviceDefinition = include (string) $cacheDefinition;
|
||||||
|
} else {
|
||||||
|
if (!$this->loader->supports($this->options['resource'], $this->options['resource_type'])) {
|
||||||
|
throw new \LogicException(sprintf('Cannot load "%s" (%s)', $this->options['resource'], $this->options['resource_type']));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->serviceDefinition = $this->loader->load($this->options['resource'], $this->options['resource_type']);
|
||||||
|
$this->serviceDefinition->setName($this->options['name']);
|
||||||
|
$this->serviceDefinition->setNamespace($this->options['namespace']);
|
||||||
|
|
||||||
|
$this->typeRepository->fixTypeInformation($this->serviceDefinition);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->serviceDefinition = $this->loader->load($this->options['resource'], $this->options['resource_type']);
|
|
||||||
$this->serviceDefinition->setName($this->options['name']);
|
|
||||||
$this->serviceDefinition->setNamespace($this->options['namespace']);
|
|
||||||
|
|
||||||
$this->typeRepository->fixTypeInformation($this->serviceDefinition);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->serviceDefinition;
|
return $this->serviceDefinition;
|
||||||
|
@ -76,14 +83,19 @@ class WebServiceContext
|
||||||
|
|
||||||
public function getWsdlFile($endpoint = null)
|
public function getWsdlFile($endpoint = null)
|
||||||
{
|
{
|
||||||
$file = sprintf('%s/%s.%s.wsdl', $this->options['cache_dir'], $this->options['name'], md5($endpoint));
|
$file = sprintf('%s/%s.%s.wsdl', $this->options['cache_dir'], $this->options['name'], md5($endpoint));
|
||||||
$cache = new ConfigCache($file, $this->options['debug']);
|
$cacheWsdl = new ConfigCache($file, $this->options['debug']);
|
||||||
|
|
||||||
if(!$cache->isFresh()) {
|
if(!$cacheWsdl->isFresh()) {
|
||||||
$cache->write($this->wsdlFileDumper->dumpServiceDefinition($this->getServiceDefinition(), $endpoint));
|
$serviceDefinition = $this->getServiceDefinition();
|
||||||
|
|
||||||
|
$cacheWsdl->write($this->wsdlFileDumper->dumpServiceDefinition($serviceDefinition, $endpoint));
|
||||||
|
|
||||||
|
$cacheDefinition = new ConfigCache(sprintf('%s/%s.definition.php', $this->options['cache_dir'], $this->options['name']), $this->options['debug']);
|
||||||
|
$cacheDefinition->write('<?php return unserialize('.var_export(serialize($serviceDefinition), true).');');
|
||||||
}
|
}
|
||||||
|
|
||||||
return (string) $cache;
|
return (string) $cacheWsdl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getServiceBinder()
|
public function getServiceBinder()
|
||||||
|
@ -116,4 +128,4 @@ class WebServiceContext
|
||||||
|
|
||||||
return $this->serverBuilder;
|
return $this->serverBuilder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue