diff --git a/DependencyInjection/BeSimpleSoapExtension.php b/DependencyInjection/BeSimpleSoapExtension.php
index 62fc3aa..941cbf0 100644
--- a/DependencyInjection/BeSimpleSoapExtension.php
+++ b/DependencyInjection/BeSimpleSoapExtension.php
@@ -51,7 +51,7 @@ class BeSimpleSoapExtension extends Extension
$this->registerCacheConfiguration($config['cache'], $container, $loader);
- if (isset($config['clients'])) {
+ if (!empty($config['clients'])) {
$this->registerClientConfiguration($config['clients'], $container, $loader);
}
@@ -146,9 +146,9 @@ class BeSimpleSoapExtension extends Extension
$options = $container
->getDefinition('besimple.soap.context.'.$bindingSuffix)
- ->getArgument(4);
+ ->getArgument(5);
- $definition->replaceArgument(4, array_merge($options, $config));
+ $definition->replaceArgument(5, array_merge($options, $config));
}
private function getCacheType($type)
diff --git a/Resources/config/webservice.xml b/Resources/config/webservice.xml
index d23f7ed..95e97b6 100644
--- a/Resources/config/webservice.xml
+++ b/Resources/config/webservice.xml
@@ -15,6 +15,7 @@
BeSimple\SoapBundle\ServiceBinding\DocumentLiteralWrappedResponseMessageBinder
BeSimple\SoapBundle\ServiceDefinition\Dumper\WsdlDumper
BeSimple\SoapBundle\Converter\TypeRepository
+ BeSimple\SoapCommon\Classmap
@@ -23,6 +24,7 @@
+
@@ -39,6 +41,7 @@
+
@@ -54,12 +57,15 @@
+
%besimple.soap.definition.dumper.options.stylesheet%
+
+
xsd
diff --git a/ServiceDefinition/Dumper/WsdlDumper.php b/ServiceDefinition/Dumper/WsdlDumper.php
index 97517f7..bf348e2 100644
--- a/ServiceDefinition/Dumper/WsdlDumper.php
+++ b/ServiceDefinition/Dumper/WsdlDumper.php
@@ -18,21 +18,25 @@ use BeSimple\SoapBundle\ServiceDefinition\Loader\AnnotationComplexTypeLoader;
use BeSimple\SoapBundle\Util\Assert;
use BeSimple\SoapBundle\Util\QName;
+use BeSimple\SoapCommon\Classmap;
+
/**
* @author Christian Kerl
*/
class WsdlDumper implements DumperInterface
{
private $loader;
+ private $classmap;
private $typeRepository;
private $options;
private $wsdl;
private $definition;
- public function __construct(AnnotationComplexTypeLoader $loader, TypeRepository $typeRepository, array $options)
+ public function __construct(AnnotationComplexTypeLoader $loader, Classmap $classmap, TypeRepository $typeRepository, array $options)
{
$this->loader = $loader;
+ $this->classmap = $classmap;
$this->typeRepository = $typeRepository;
$this->options = $options;
}
@@ -42,7 +46,7 @@ class WsdlDumper implements DumperInterface
Assert::thatArgumentNotNull('definition', $definition);
$this->definition = $definition;
- $this->wsdl = new Wsdl($this->typeRepository, $definition->getName(), $definition->getNamespace(), new WsdlTypeStrategy($this->loader, $definition));
+ $this->wsdl = new Wsdl($this->typeRepository, $definition->getName(), $definition->getNamespace(), new WsdlTypeStrategy($this->loader, $this->classmap, $definition));
$port = $this->wsdl->addPortType($this->getPortTypeName());
$binding = $this->wsdl->addBinding($this->getBindingName(), $this->qualify($this->getPortTypeName()));
diff --git a/ServiceDefinition/Dumper/WsdlTypeStrategy.php b/ServiceDefinition/Dumper/WsdlTypeStrategy.php
index 62610e8..1d35d9c 100644
--- a/ServiceDefinition/Dumper/WsdlTypeStrategy.php
+++ b/ServiceDefinition/Dumper/WsdlTypeStrategy.php
@@ -15,6 +15,8 @@ use BeSimple\SoapBundle\ServiceDefinition\Loader\AnnotationComplexTypeLoader;
use BeSimple\SoapBundle\ServiceDefinition\Strategy\ComplexType;
use BeSimple\SoapBundle\Util\String;
+use BeSimple\SoapCommon\Classmap;
+
use Zend\Soap\Exception;
use Zend\Soap\Wsdl as BaseWsdl;
use Zend\Soap\Wsdl\Strategy;
@@ -30,14 +32,16 @@ class WsdlTypeStrategy implements Strategy
private $context;
private $loader;
+ private $classmap;
private $definition;
private $typeStrategy;
private $arrayStrategy;
- public function __construct(AnnotationComplexTypeLoader $loader, ServiceDefinition $definition)
+ public function __construct(AnnotationComplexTypeLoader $loader, Classmap $classmap, ServiceDefinition $definition)
{
$this->loader = $loader;
+ $this->classmap = $classmap;
$this->definition = $definition;
}
@@ -86,7 +90,7 @@ class WsdlTypeStrategy implements Strategy
private function getTypeStrategy()
{
if (!$this->typeStrategy) {
- $this->typeStrategy = new ComplexType($this->loader, $this->definition);
+ $this->typeStrategy = new ComplexType($this->loader, $this->classmap, $this->definition);
$this->typeStrategy->setContext($this->context);
}
diff --git a/ServiceDefinition/Strategy/ComplexType.php b/ServiceDefinition/Strategy/ComplexType.php
index 8af3fb1..b608902 100644
--- a/ServiceDefinition/Strategy/ComplexType.php
+++ b/ServiceDefinition/Strategy/ComplexType.php
@@ -12,6 +12,7 @@ namespace BeSimple\SoapBundle\ServiceDefinition\Strategy;
use BeSimple\SoapBundle\ServiceDefinition\Loader\AnnotationComplexTypeLoader;
+use BeSimple\SoapCommon\Classmap;
use Zend\Soap\Wsdl;
use Zend\Soap\Wsdl\Strategy\AbstractStrategy;
@@ -21,11 +22,13 @@ use Zend\Soap\Wsdl\Strategy\AbstractStrategy;
class ComplexType extends AbstractStrategy
{
private $loader;
+ private $classmap;
private $definition;
- public function __construct(AnnotationComplexTypeLoader $loader, $definition)
+ public function __construct(AnnotationComplexTypeLoader $loader, Classmap $classmap, $definition)
{
$this->loader = $loader;
+ $this->classmap = $classmap;
$this->definition = $definition;
}
@@ -50,6 +53,8 @@ class ComplexType extends AbstractStrategy
$soapTypeName = Wsdl::translateType($type);
$soapType = 'tns:'.$soapTypeName;
+ $this->classmap->add($soapTypeName, $type);
+
// Register type here to avoid recursion
$this->getContext()->addType($type, $soapType);
diff --git a/Soap/SoapServerFactory.php b/Soap/SoapServerFactory.php
index 7282f09..caa133f 100644
--- a/Soap/SoapServerFactory.php
+++ b/Soap/SoapServerFactory.php
@@ -11,6 +11,7 @@
namespace BeSimple\SoapBundle\Soap;
use BeSimple\SoapCommon\Cache;
+use BeSimple\SoapCommon\Classmap;
use BeSimple\SoapCommon\Converter\TypeConverterCollection;
use Zend\Soap\Wsdl;
@@ -25,11 +26,12 @@ class SoapServerFactory
private $converters;
private $options;
- public function __construct($wsdlFile, array $classmap, TypeConverterCollection $converters, array $options = array())
+ public function __construct($wsdlFile, Classmap $classmap, TypeConverterCollection $converters, array $options = array())
{
$this->wsdlFile = $wsdlFile;
- $this->classmap = $this->fixSoapServerClassmap($classmap);
+ $this->classmap = $classmap;
$this->converters = $converters;
+
$this->setOptions($options);
}
@@ -66,22 +68,11 @@ class SoapServerFactory
return new \SoapServer(
$this->wsdlFile,
array(
- 'classmap' => $this->classmap,
+ 'classmap' => $this->classmap->all(),
'typemap' => $this->converters->getTypemap(),
'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
'cache_wsdl' => null !== $this->options['cache_type'] ? $this->options['cache_type'] : Cache::getType(),
)
);
}
-
- private function fixSoapServerClassmap($classmap)
- {
- $classmapFixed = array();
-
- foreach ($classmap as $class => $definition) {
- $classmapFixed[Wsdl::translateType($class)] = $class;
- }
-
- return $classmapFixed;
- }
-}
\ No newline at end of file
+}
diff --git a/WebServiceContext.php b/WebServiceContext.php
index e03b200..666c806 100644
--- a/WebServiceContext.php
+++ b/WebServiceContext.php
@@ -16,6 +16,7 @@ use BeSimple\SoapBundle\ServiceBinding\ServiceBinder;
use BeSimple\SoapBundle\ServiceDefinition\Dumper\DumperInterface;
use BeSimple\SoapBundle\Soap\SoapServerFactory;
+use BeSimple\SoapCommon\Classmap;
use BeSimple\SoapCommon\Converter\TypeConverterCollection;
use Symfony\Component\Config\ConfigCache;
@@ -39,10 +40,12 @@ class WebServiceContext
private $serviceBinder;
private $serverFactory;
- public function __construct(LoaderInterface $loader, DumperInterface $dumper, TypeRepository $typeRepository, TypeConverterCollection $converters, array $options) {
+ public function __construct(LoaderInterface $loader, DumperInterface $dumper, Classmap $classmap, TypeRepository $typeRepository, TypeConverterCollection $converters, array $options) {
$this->loader = $loader;
$this->wsdlFileDumper = $dumper;
+ $this->classmap = $classmap;
+
$this->typeRepository = $typeRepository;
$this->converters = $converters;
@@ -102,7 +105,7 @@ class WebServiceContext
if (null === $this->serverFactory) {
$this->serverFactory = new SoapServerFactory(
$this->getWsdlFile(),
- $this->serviceDefinition->getDefinitionComplexTypes(),
+ $this->classmap,
$this->converters,
array(
'debug' => $this->options['debug'],