diff --git a/DependencyInjection/BeSimpleSoapExtension.php b/DependencyInjection/BeSimpleSoapExtension.php index 941cbf0..053aa42 100644 --- a/DependencyInjection/BeSimpleSoapExtension.php +++ b/DependencyInjection/BeSimpleSoapExtension.php @@ -51,9 +51,7 @@ public function load(array $configs, ContainerBuilder $container) $this->registerCacheConfiguration($config['cache'], $container, $loader); - if (!empty($config['clients'])) { - $this->registerClientConfiguration($config['clients'], $container, $loader); - } + $this->registerClientConfiguration($config['clients'], $container, $loader); $container->setParameter('besimple.soap.definition.dumper.options.stylesheet', $config['wsdl_dumper']['stylesheet']); diff --git a/ServiceBinding/RpcLiteralRequestMessageBinder.php b/ServiceBinding/RpcLiteralRequestMessageBinder.php index f550a8b..6add004 100644 --- a/ServiceBinding/RpcLiteralRequestMessageBinder.php +++ b/ServiceBinding/RpcLiteralRequestMessageBinder.php @@ -54,7 +54,7 @@ protected function processType($phpType, $message) } // @TODO Fix array reference - if (isset($this->definitionComplexTypes[$phpType])) { + if (isset($this->definitionComplexTypes[$phpType]) && $message) { if ($isArray) { if (isset($message->item)) { foreach ($message->item as $complexType) { diff --git a/ServiceDefinition/Annotation/ComplexType.php b/ServiceDefinition/Annotation/ComplexType.php index 85072d4..a2eeff7 100644 --- a/ServiceDefinition/Annotation/ComplexType.php +++ b/ServiceDefinition/Annotation/ComplexType.php @@ -18,6 +18,7 @@ class ComplexType extends Configuration private $name; private $value; private $isNillable = false; + private $minOccurs = 1; public function getName() { @@ -53,4 +54,14 @@ public function getAliasName() { return 'complextype'; } + + public function getMinOccurs() + { + return $this->minOccurs; + } + + public function setMinOccurs($minOccurs) + { + $this->minOccurs = (int) $minOccurs; + } } \ No newline at end of file diff --git a/ServiceDefinition/ComplexType.php b/ServiceDefinition/ComplexType.php index 2d78bbe..e36dbd2 100644 --- a/ServiceDefinition/ComplexType.php +++ b/ServiceDefinition/ComplexType.php @@ -18,6 +18,7 @@ class ComplexType private $name; private $value; private $isNillable = false; + private $minOccurs = 1; public function getName() { @@ -48,4 +49,16 @@ public function setNillable($isNillable) { $this->isNillable = (bool) $isNillable; } + + public function getMinOccurs() + { + return $this->minOccurs; + } + + public function setMinOccurs($minOccurs) + { + if (null !== $minOccurs) { + $this->minOccurs = (int) $minOccurs; + } + } } \ No newline at end of file diff --git a/ServiceDefinition/Dumper/WsdlDumper.php b/ServiceDefinition/Dumper/WsdlDumper.php index abe64c3..588caec 100644 --- a/ServiceDefinition/Dumper/WsdlDumper.php +++ b/ServiceDefinition/Dumper/WsdlDumper.php @@ -38,7 +38,7 @@ public function __construct(AnnotationComplexTypeLoader $loader, TypeRepository } public function dumpServiceDefinition(ServiceDefinition $definition, $endpoint) - { + { Assert::thatArgumentNotNull('definition', $definition); $this->definition = $definition; @@ -79,6 +79,10 @@ public function dumpServiceDefinition(ServiceDefinition $definition, $endpoint) $this->qualify($this->getResponseMessageName($method)) ); + if ($method->getDocumentation()) { + $this->wsdl->addDocumentation($portOperation, $method->getDocumentation()); + } + $baseBinding = $inputBinding = $outputBinding = array( diff --git a/ServiceDefinition/Loader/AnnotationClassLoader.php b/ServiceDefinition/Loader/AnnotationClassLoader.php index d76ec56..57bb6a9 100644 --- a/ServiceDefinition/Loader/AnnotationClassLoader.php +++ b/ServiceDefinition/Loader/AnnotationClassLoader.php @@ -16,7 +16,7 @@ use Doctrine\Common\Annotations\Reader; use Symfony\Component\Config\Loader\LoaderInterface; -use Symfony\Component\Config\Loader\LoaderResolver; +use Symfony\Component\Config\Loader\LoaderResolverInterface; /** * AnnotationClassLoader loads ServiceDefinition from a PHP class and its methods. @@ -104,6 +104,8 @@ public function load($class, $type = null) } $serviceReturn = new Definition\Type($annotation->getPhpType(), $annotation->getXmlType()); + } elseif ($annotation instanceof Annotation\Documentation) { + $serviceMethod->setDocumentation($annotation->getValue()); } } @@ -185,7 +187,7 @@ public function supports($resource, $type = null) * * @param LoaderResolver $resolver A LoaderResolver instance */ - public function setResolver(LoaderResolver $resolver) + public function setResolver(LoaderResolverInterface $resolver) { } diff --git a/ServiceDefinition/Loader/AnnotationComplexTypeLoader.php b/ServiceDefinition/Loader/AnnotationComplexTypeLoader.php index 0cc7579..9230906 100644 --- a/ServiceDefinition/Loader/AnnotationComplexTypeLoader.php +++ b/ServiceDefinition/Loader/AnnotationComplexTypeLoader.php @@ -50,6 +50,7 @@ public function load($class, $type = null) $propertyComplexType = new ComplexType(); $propertyComplexType->setValue($complexType->getValue()); $propertyComplexType->setNillable($complexType->isNillable()); + $propertyComplexType->setMinOccurs($complexType->getMinOccurs()); $propertyComplexType->setName($property->getName()); $collection->add($propertyComplexType); } diff --git a/ServiceDefinition/Method.php b/ServiceDefinition/Method.php index a03053f..61e6023 100644 --- a/ServiceDefinition/Method.php +++ b/ServiceDefinition/Method.php @@ -19,6 +19,7 @@ class Method private $arguments; private $headers; private $return; + private $documentation; public function __construct($name = null, $controller = null, array $headers = array(), array $arguments = array(), Type $return = null) { @@ -83,4 +84,14 @@ public function setReturn(Type $return) { $this->return = $return; } + + public function getDocumentation() + { + return $this->documentation; + } + + public function setDocumentation($documentation) + { + $this->documentation = $documentation; + } } \ No newline at end of file diff --git a/ServiceDefinition/Strategy/ComplexType.php b/ServiceDefinition/Strategy/ComplexType.php index 88c1adf..e772607 100644 --- a/ServiceDefinition/Strategy/ComplexType.php +++ b/ServiceDefinition/Strategy/ComplexType.php @@ -75,6 +75,10 @@ public function addComplexType($type) $element->setAttribute('nillable', 'true'); } + if (1 !== $annotationComplexType->getMinOccurs()) { + $element->setAttribute('minOccurs', $annotationComplexType->getMinOccurs()); + } + $all->appendChild($element); } diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..f449ca8 --- /dev/null +++ b/composer.json @@ -0,0 +1,28 @@ +{ + "name": "besimple/soap-bundle", + "type": "symfony-bundle", + "description": "Build and consume SOAP and WSDL based web services with Symfony2", + "keywords": [ "soap" ], + "homepage": "http://besim.pl/SoapBundle/", + "authors": [ + { + "name": "Christian Kerl" + }, + { + "name": "Francis Besset", + "email": "francis.besset@gmail.com" + } + ], + "require": { + "php": ">=5.3.0", + "besimple/soap-common": "*" + }, + "suggest": { + "besimple/soap-client": "*", + "besimple/soap-server": "*" + }, + "autoload": { + "psr-0": { "BeSimple\\SoapBundle": "" } + }, + "target-dir": "BeSimple/SoapBundle" +} \ No newline at end of file