wsdl definition can now be retrieved; aligned controller method and route naming;

This commit is contained in:
Christian Kerl
2011-04-08 00:46:58 +02:00
parent a4d69aedbc
commit fa07646e3a
4 changed files with 49 additions and 21 deletions

View File

@ -10,21 +10,21 @@
namespace Bundle\WebServiceBundle;
use Symfony\Component\Config\ConfigCache;
use Symfony\Component\Config\Loader\LoaderInterface;
use Bundle\WebServiceBundle\Converter\ConverterRepository;
use Bundle\WebServiceBundle\ServiceBinding\ServiceBinder;
use Bundle\WebServiceBundle\ServiceBinding\MessageBinderInterface;
use Bundle\WebServiceBundle\ServiceDefinition\Dumper\DumperInterface;
use Bundle\WebServiceBundle\Soap\SoapServerFactory;
/**
* WebServiceContext.
*
* @author Christian Kerl <christian-kerl@web.de>
*/
use Bundle\WebServiceBundle\ServiceDefinition\Dumper\DumperInterface;
use Bundle\WebServiceBundle\ServiceBinding\MessageBinderInterface;
use Bundle\WebServiceBundle\Converter\ConverterRepository;
use Bundle\WebServiceBundle\ServiceBinding\ServiceBinder;
use Bundle\WebServiceBundle\Soap\SoapServerFactory;
class WebServiceContext
{
private $converterRepository;
@ -56,15 +56,36 @@ class WebServiceContext
{
if($this->serviceDefinition === null)
{
if(!$this->serviceDefinitionLoader->supports($this->options['resource'], $this->options['resource_type']))
{
throw new \LogicException();
}
$this->serviceDefinition = $this->serviceDefinitionLoader->load($this->options['resource'], $this->options['resource_type']);
$this->serviceDefinition->setName($this->options['name']);
$this->serviceDefinition->setNamespace($this->options['namespace']);
}
;
return $this->serviceDefinition;
}
public function getWsdlFile()
public function getWsdlFile($endpoint = null)
{
;
$id = $endpoint !== null ? '.' . md5($endpoint) : '';
$file = sprintf('%s/%s.wsdl', $this->options['cache_dir'], $this->options['name'] . $id);
$cache = new ConfigCache($file, true);
if(!$cache->isFresh())
{
$cache->write($this->wsdlFileDumper->dumpServiceDefinition($this->getServiceDefinition(), array('endpoint' => $endpoint)));
}
return $file;
}
public function getWsdlFileContent($endpoint = null)
{
return file_get_contents($this->getWsdlFile($endpoint));
}
public function getServiceBinder()